import {mapGetters} from 'vuex'
import moment from 'moment';
import {VIDEOURL,DYNAMIC,OCTIONTEXT,INDUSTRY,UPLOADVIDEO,IMGLIST,UPLOADCOVER,PROGRAM,VIDEOCOVER} from '@/services/api'
import {ajaxrequest,ajaxfile,ajaxparems} from '@/services/ajaxrequest'
var datainfo = [];
var medialabel =[
    {
        title: 'APP名称',
        dataIndex: 'name',
        filterMultiple: true,
    },
];

var scenelabel = [
    {
        title: '位置选择',
        dataIndex: 'name',
    },
];

var medialist = [
    {
        key:"1",
        name:"今日头条",
        value:"INVENTORY_FEED",
    },{
        key:"2",
        name:"西瓜视频",
        value:"INVENTORY_VIDEO_FEED",
    },{
        key:"3",
        name:"抖音火山版",
        value:"INVENTORY_HOTSOON_FEED",
    },{
        key:"4",
        name:"抖音",
        value:"INVENTORY_AWEME_FEED",
    },{
        key:"5",
        name:"穿山甲",
        value:"INVENTORY_UNION_SLOT",
    }
];

var scenelist = [
    {
        key:'1',
        name:'沉浸式竖版视频场景',
        value:'VIDEO_SCENE'
    },{
        key:'2',
        name:'信息流场景',
        value:'FEED_SCENE'
    },{
        key:'3',
        name:'视频后贴和尾帧场景',
        value:'TAIL_SCENE'
    }
];
var cenelistbox = [];
var mediaboxlist = [];

var dynamiclabel = [
    {
        title:'词包',
        dataIndex:"name",
    },
    {
        title:'默认词',
        dataIndex:'default_word',
    },
    {
        title:'替换词',
        dataIndex:'words',
        ellipsis: true,
    },{
        title:'用户覆盖率',
        dataIndex:'user_rate',
    },{
        title:'状态',
        dataIndex:'status',
        scopedSlots: { customRender: 'statusDemo' },
    },{
        title:'操作',
        name:'name',
        ids:'creative_word_id',
        scopedSlots: { customRender: 'action' }
    }
];
const landing_type = '';

var systemlabel = [
    {
        title:"系统推荐卖点",
        dataIndex:"name",
        
    }
];
var systemlist = [
    {
        key:'1',
        name:"真实模拟经营商战"
    },{
        key:'2',
        name:"建立属于自己的帝国"
    },{
        key:'3',
        name:"让你体验身临其境"
    },{
        key:'4',
        name:"带你打造商业帝国"
    },{
        key:'5',
        name:"让你的商业更加自信"
    },{
        key:'6',
        name:"开创自己的商业帝国"
    },{
        key:'7',
        name:"完全颠覆传统模式"
    },{
        key:'8',
        name:"我的命运由我掌握"
    },{
        key:'9',
        name:"白手起家逆袭成总裁"
    },{
        key:'10',
        name:"超炫酷的人物模型"
    }
];

var choicelabel = [
    {
        title:'ID',
        dataIndex: 'id',
    },{
        title:'创意包名称',
        dataIndex: 'name',
    },{
        title:'创建事件',
        dataIndex: 'name',
    },{
        title:'使用账号',
        dataIndex: 'name',
    },{
        title:'操作',
        dataIndex: 'option',
    },
];

var rowsystemlist = [];
export default {
    created(){
        var ad_ids = this.$route.query.ad_id;
        var campaign_id = this.$route.query.campaign_id;
        this.id = ad_ids;
        this.campaign_id = campaign_id;
        this.pageinfo();
    },
    beforeCreate() {
        this.form = this.$form.createForm(this);
    },
    data() {
        const originality = [];
        return {
            spinning:true,
            id:'',
            landing_type,
            campaign_id:'',
            datainfo,
            campaigninfo:[],
            advertiserinfo:[],
            inventory:"smart_inventory",
            material:"NONE",
            source:"0",
            title:'',
            scene:0,
            pages:false,
            medialabel,
            medialist,
            scenelabel,
            scenelist,
            cenelistbox,
            mediaboxlist,
            originshow:true,
            modeacrive:"1",
            originindex:'',
            addlist:[1],
            originbtn:false,
            tablist:[1],
            tabactive:0,
            tabtrue:false,
            tabvideo:false,
            tabimage:false,
            videoshow:false,
            videodata:[],
            videoactive:'',
            videonum:0,
            creative_word_ids:[],
            dynamicmore:false,
            dynamiclabel,
            dynamiclist:[],
            cardbox:false,
            cardboximg:'',
            value:1,
            cardtitle:'',
            inputlist:[{
                valuename:'product_selling_points1',
                value:'',
            }],
            pointsnum:1,
            btnpoint:false,
            actiontext:'true',
            calllist:[],
            brandhome:0,
            avaterimg:'',
            comments:'0',
            toshow:'CREATIVE_DISPLAY_MODE_RANDOM',
            typelist:[],
            labellist:[],
            systemshow:false,
            systemlabel,
            systemlist,
            rowsystemlist,
            inputnum:1,
            addtitledis:false,
            choiceorignbox:false,
            choicelabel,
            logging: false,
            originalitylist:[{
                title:1,
            }],
            originality,
            confirmLoading:false,
            videoloding:false,
            coverloding:false,
            dynamicloding:false,
            uploadloading:false,
            imgloading:false,
        };
    },
    methods: {
        moment,
        ongoback(){
            this.$router.go(-2);//返回广告组
            window.localStorage.removeItem("one");
            window.localStorage.removeItem("two");
            window.localStorage.removeItem("three");
        },
        ongobacktwo(){
            this.$router.go(-1);
            window.localStorage.removeItem("one");
            window.localStorage.removeItem("two");
        },

        handleOk(){
            // 取消框确认按钮
            this.$router.go(-2);//返回上二层
            window.localStorage.removeItem("one");
            window.localStorage.removeItem("two");
            window.localStorage.removeItem("three");
            this.visible = false;
        },
        handleCancel(){
            //取消框的取消按钮
            this.visible = false;
        },

        pageinfo(){
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            this.scene = page.scene;
            var towinfo = storage.getItem("two");
            var two = JSON.parse(towinfo);
            var newtwo = {};
            if(page.type ==1){
                var plannum = 0;
                if(two.plannum !=undefined){
                    plannum = two.plannum;
                }else{
                    plannum = 1;
                }
                for(var i =0;i < plannum;i++){
                    var num = i+1;
                    newtwo = {
                        key:num,
                        creative_material_mode:`creative_material_mode${num}`,
                        material:'NONE',
                        originname:`name${num}`,
                        originvalue:`创意组${num}`,
                        program:{
                            imgnum:0,
                            videonum:0,
                        },
                        customnum:0,
                        customactive:"1",
                        progractive:'1',
                        num:[],
                        tabtrue:false,
                        videonums:[],
                        imagenums:[],
                        tabimage:false,
                        tabvideo:false,
                        videoshow:false,
                        
                        input:[{
                            value:'titles1',
                            nametitle:'',
                            dynamicmores:false,
                            dynamiclists:[],
                            words_ids:[],
                        }],
                        inputnum:1,
                        addtitledis:false,
                        paneslist:[
                            {
                                title:'竖版视频',
                                img:this.imgurl('15_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'140',
                                    height:'250',
                                    addpanel:[{
                                        title:'创意1',
                                        key:'1',
                                        videoUrl:'',
                                        imageUrl:'',
                                        uploadloading:false,
                                        btnloading:false,
                                        imgloading:false,
                                        nametitle:'',
                                        image_ids:[],
                                        image_id:'',
                                        video_id:'',
                                        input:'title1',
                                        derive_poster_cid:false,
                                        videoshow:false,
                                        covershow:false,
                                        dynamicmore:false,
                                        videonum:0,
                                        covernum:0,
                                        videolist:[],
                                        coverlist:[],
                                        dynamiclist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        creative_word_ids:[]
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },{
                                title:'横版视频',
                                img:this.imgurl('5_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_VIDEO',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'250',
                                    height:'140',
                                    addpanel:[{
                                        title:'创意1',
                                        key:'1',
                                        videoUrl:'',
                                        imageUrl:'',
                                        uploadloading:false,
                                        btnloading:false,
                                        imgloading:false,
                                        nametitle:'',
                                        image_ids:[],
                                        image_id:'',
                                        video_id:'',
                                        input:'title1',
                                        derive_poster_cid:false,
                                        videoshow:false,
                                        covershow:false,
                                        dynamicmore:false,
                                        videonum:0,
                                        covernum:0,
                                        videolist:[],
                                        coverlist:[],
                                        dynamiclist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        creative_word_ids:[]
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },{
                                title:'大图横图',
                                img:this.imgurl('3_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_LARGE',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'250',
                                    height:'140',
                                    addpanel:[{
                                        title:'创意1',
                                        key:'1',
                                        videoUrl:'',
                                        imageUrl:'',
                                        uploadloading:false,
                                        btnloading:false,
                                        imgloading:false,
                                        nametitle:'',
                                        image_ids:[],
                                        image_id:'',
                                        video_id:'',
                                        input:'title1',
                                        derive_poster_cid:false,
                                        videoshow:false,
                                        covershow:false,
                                        dynamicmore:false,
                                        videonum:0,
                                        covernum:0,
                                        videolist:[],
                                        coverlist:[],
                                        dynamiclist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        creative_word_ids:[]
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },{
                                title:'组图',
                                img:this.imgurl('4_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_GROUP',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'178',
                                    height:'117',
                                    addpanel:[{
                                        title:'创意1',
                                        key:'1',
                                        videoUrl:'',
                                        group:[{
                                            img:'',
                                            showis:false,
                                            btnloading:false,
                                            imgloading:false,
                                            nums:0,
                                            activeimg:'',
                                            image_id:'',
                                        },{
                                            img:'',
                                            showis:false,
                                            btnloading:false,
                                            imgloading:false,
                                            nums:0,
                                            activeimg:'',
                                            image_id:'',
                                        },{
                                            img:'',
                                            showis:false,
                                            btnloading:false,
                                            imgloading:false,
                                            nums:0,
                                            activeimg:'',
                                            image_id:'',
                                        }],
                                        nametitle:'',
                                        image_ids:[],
                                        video_id:'',
                                        input:'title1',
                                        derive_poster_cid:false,
                                        videoshow:false,
                                        covershow:false,
                                        dynamicmore:false,
                                        videonum:0,
                                        covernum:[],
                                        videolist:[],
                                        coverlist:[],
                                        dynamiclist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        creative_word_ids:[]
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },{
                                title:'小图',
                                img:this.imgurl('2_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_SMALL',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'232',
                                    height:'152',
                                    addpanel:[{
                                        title:'创意1',
                                        key:'1',
                                        videoUrl:'',
                                        imageUrl:'',
                                        btnloading:false,
                                        imgloading:false,
                                        nametitle:'',
                                        image_ids:[],
                                        image_id:'',
                                        video_id:'',
                                        input:'title1',
                                        derive_poster_cid:false,
                                        videoshow:false,
                                        covershow:false,
                                        dynamicmore:false,
                                        videonum:0,
                                        covernum:0,
                                        videolist:[],
                                        coverlist:[],
                                        dynamiclist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        creative_word_ids:[]
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },{
                                title:'大图竖图',
                                img:this.imgurl('16_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_LARGE_VERTICAL',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'140',
                                    height:'250',
                                    addpanel:[{
                                        title:'创意1',
                                        key:'1',
                                        videoUrl:'',
                                        imageUrl:'',
                                        btnloading:false,
                                        imgloading:false,
                                        nametitle:'',
                                        image_ids:[],
                                        image_id:'',
                                        video_id:'',
                                        input:'title1',
                                        derive_poster_cid:false,
                                        videoshow:false,
                                        covershow:false,
                                        dynamicmore:false,
                                        videonum:0,
                                        covernum:0,
                                        videolist:[],
                                        coverlist:[],
                                        dynamiclist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        creative_word_ids:[]
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },
                        ],
                        customlist:[
                            {
                                title:'竖版视频',
                                img:this.imgurl('15_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'140',
                                    height:'250',
                                    addpanel:[{
                                        key:'1',
                                        videoUrl:'',
                                        imageUrl:'',
                                        uploadloading:false,
                                        btnloading:false,
                                        imgloading:false,
                                        videoshow:false,
                                        covershow:false,
                                        image_id:'',
                                        video_id:'',
                                        videolist:[],
                                        coverlist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        videonum:0,
                                        covernum:0,
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },{
                                title:'横版视频',
                                img:this.imgurl('5_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_VIDEO',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'250',
                                    height:'140',
                                    addpanel:[{
                                        key:'1',
                                        videoUrl:'',
                                        imageUrl:'',
                                        uploadloading:false,
                                        btnloading:false,
                                        imgloading:false,
                                        videoshow:false,
                                        covershow:false,
                                        image_id:'',
                                        video_id:'',
                                        videolist:[],
                                        coverlist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        videonum:0,
                                        covernum:0,
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },{
                                title:'大图横图',
                                img:this.imgurl('3_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_LARGE',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'250',
                                    height:'140',
                                    addpanel:[{
                                        key:'1',
                                        videoUrl:'',
                                        imageUrl:'',
                                        btnloading:false,
                                        imgloading:false,
                                        videoshow:false,
                                        covershow:false,
                                        image_id:'',
                                        video_id:'',
                                        videolist:[],
                                        coverlist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        videonum:0,
                                        covernum:0,
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },{
                                title:'小图',
                                img:this.imgurl('2_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_SMALL',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'232',
                                    height:'152',
                                    addpanel:[{
                                        key:'1',
                                        videoUrl:'',
                                        imageUrl:'',
                                        btnloading:false,
                                        imgloading:false,
                                        videoshow:false,
                                        covershow:false,
                                        image_id:'',
                                        video_id:'',
                                        videolist:[],
                                        coverlist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        videonum:0,
                                        covernum:0,
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },{
                                title:'大图竖图',
                                img:this.imgurl('16_S.svg'),
                                value:'CREATIVE_IMAGE_MODE_LARGE_VERTICAL',
                                content:{
                                    panelshow:true,
                                    show:false,
                                    num:0,
                                    width:'140',
                                    height:'250',
                                    addpanel:[{
                                        key:'1',
                                        videoUrl:'',
                                        imageUrl:'',
                                        imgloading:false,
                                        btnloading:false,
                                        videoshow:false,
                                        covershow:false,
                                        image_id:'',
                                        video_id:'',
                                        videolist:[],
                                        coverlist:[],
                                        videoactive:'',
                                        coveractive:'',
                                        videonum:0,
                                        covernum:0,
                                    }],
                                    activeKey:1,
                                    newTabIndex: 2,
                                },
                            },
                        ],
                    }
                    this.originality.push(newtwo);
                }
            }else{
                newtwo = {
                    key:num,
                    creative_material_mode:`creative_material_mode1`,
                    material:'NONE',
                    originname:`name1`,
                    originvalue:`创意组1`,
                    program:{
                        imgnum:0,
                        videonum:0,
                    },
                    customnum:0,
                    customactive:"1",
                    progractive:'1',
                    num:[],
                    tabtrue:false,
                    videonums:[],
                    imagenums:[],
                    tabimage:false,
                    tabvideo:false,
                    input:[{
                        value:'titles1',
                        nametitle:'',
                        dynamicmores:false,
                        dynamiclists:[],
                        words_ids:[],
                    }],
                    inputnum:1,
                    addtitledis:false,
                    paneslist:[
                        {
                            title:'竖版视频',
                            img:this.imgurl('15_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'140',
                                height:'250',
                                addpanel:[{
                                    title:'创意1',
                                    key:'1',
                                    videoUrl:'',
                                    imageUrl:'',
                                    uploadloading:false,
                                    btnloading:false,
                                    imgloading:false,
                                    nametitle:'',
                                    image_ids:[],
                                    image_id:'',
                                    video_id:'',
                                    input:'title1',
                                    derive_poster_cid:false,
                                    videoshow:false,
                                    covershow:false,
                                    dynamicmore:false,
                                    videonum:0,
                                    covernum:0,
                                    videolist:[],
                                    coverlist:[],
                                    dynamiclist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    creative_word_ids:[]
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },{
                            title:'横版视频',
                            img:this.imgurl('5_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_VIDEO',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'250',
                                height:'140',
                                addpanel:[{
                                    title:'创意1',
                                    key:'1',
                                    videoUrl:'',
                                    imageUrl:'',
                                    uploadloading:false,
                                    btnloading:false,
                                    imgloading:false,
                                    nametitle:'',
                                    image_ids:[],
                                    image_id:'',
                                    video_id:'',
                                    input:'title1',
                                    derive_poster_cid:false,
                                    videoshow:false,
                                    covershow:false,
                                    dynamicmore:false,
                                    videonum:0,
                                    covernum:0,
                                    videolist:[],
                                    coverlist:[],
                                    dynamiclist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    creative_word_ids:[]
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },{
                            title:'大图横图',
                            img:this.imgurl('3_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_LARGE',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'250',
                                height:'140',
                                addpanel:[{
                                    title:'创意1',
                                    key:'1',
                                    videoUrl:'',
                                    imageUrl:'',
                                    uploadloading:false,
                                    btnloading:false,
                                    imgloading:false,
                                    nametitle:'',
                                    image_ids:[],
                                    image_id:'',
                                    video_id:'',
                                    input:'title1',
                                    derive_poster_cid:false,
                                    videoshow:false,
                                    covershow:false,
                                    dynamicmore:false,
                                    videonum:0,
                                    covernum:0,
                                    videolist:[],
                                    coverlist:[],
                                    dynamiclist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    creative_word_ids:[]
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },{
                            title:'组图',
                            img:this.imgurl('4_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_GROUP',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'178',
                                height:'117',
                                addpanel:[{
                                    title:'创意1',
                                    key:'1',
                                    videoUrl:'',
                                    group:[{
                                        img:'',
                                        showis:false,
                                        btnloading:false,
                                        imgloading:false,
                                        nums:0,
                                        activeimg:'',
                                        image_id:'',
                                    },{
                                        img:'',
                                        showis:false,
                                        btnloading:false,
                                        imgloading:false,
                                        nums:0,
                                        activeimg:'',
                                        image_id:'',
                                    },{
                                        img:'',
                                        showis:false,
                                        btnloading:false,
                                        imgloading:false,
                                        nums:0,
                                        activeimg:'',
                                        image_id:'',
                                    }],
                                    nametitle:'',
                                    image_ids:[],
                                    video_id:'',
                                    input:'title1',
                                    derive_poster_cid:false,
                                    videoshow:false,
                                    covershow:false,
                                    dynamicmore:false,
                                    videonum:0,
                                    covernum:[],
                                    videolist:[],
                                    coverlist:[],
                                    dynamiclist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    creative_word_ids:[]
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },{
                            title:'小图',
                            img:this.imgurl('2_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_SMALL',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'232',
                                height:'152',
                                addpanel:[{
                                    title:'创意1',
                                    key:'1',
                                    videoUrl:'',
                                    imageUrl:'',
                                    btnloading:false,
                                    imgloading:false,
                                    nametitle:'',
                                    image_ids:[],
                                    image_id:'',
                                    video_id:'',
                                    input:'title1',
                                    derive_poster_cid:false,
                                    videoshow:false,
                                    covershow:false,
                                    dynamicmore:false,
                                    videonum:0,
                                    covernum:0,
                                    videolist:[],
                                    coverlist:[],
                                    dynamiclist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    creative_word_ids:[]
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },{
                            title:'大图竖图',
                            img:this.imgurl('16_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_LARGE_VERTICAL',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'140',
                                height:'250',
                                addpanel:[{
                                    title:'创意1',
                                    key:'1',
                                    videoUrl:'',
                                    imageUrl:'',
                                    btnloading:false,
                                    imgloading:false,
                                    nametitle:'',
                                    image_ids:[],
                                    image_id:'',
                                    video_id:'',
                                    input:'title1',
                                    derive_poster_cid:false,
                                    videoshow:false,
                                    covershow:false,
                                    dynamicmore:false,
                                    videonum:0,
                                    covernum:0,
                                    videolist:[],
                                    coverlist:[],
                                    dynamiclist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    creative_word_ids:[]
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },
                    ],
                    customlist:[
                        {
                            title:'竖版视频',
                            img:this.imgurl('15_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'140',
                                height:'250',
                                addpanel:[{
                                    key:'1',
                                    videoUrl:'',
                                    imageUrl:'',
                                    uploadloading:false,
                                    btnloading:false,
                                    imgloading:false,
                                    videoshow:false,
                                    covershow:false,
                                    image_id:'',
                                    video_id:'',
                                    videolist:[],
                                    coverlist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    videonum:0,
                                    covernum:0,
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },{
                            title:'横版视频',
                            img:this.imgurl('5_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_VIDEO',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'250',
                                height:'140',
                                addpanel:[{
                                    key:'1',
                                    videoUrl:'',
                                    imageUrl:'',
                                    uploadloading:false,
                                    btnloading:false,
                                    imgloading:false,
                                    videoshow:false,
                                    covershow:false,
                                    image_id:'',
                                    video_id:'',
                                    videolist:[],
                                    coverlist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    videonum:0,
                                    covernum:0,
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },{
                            title:'大图横图',
                            img:this.imgurl('3_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_LARGE',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'250',
                                height:'140',
                                addpanel:[{
                                    key:'1',
                                    videoUrl:'',
                                    imageUrl:'',
                                    uploadloading:false,
                                    btnloading:false,
                                    imgloading:false,
                                    videoshow:false,
                                    covershow:false,
                                    image_id:'',
                                    video_id:'',
                                    videolist:[],
                                    coverlist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    videonum:0,
                                    covernum:0,
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },{
                            title:'小图',
                            img:this.imgurl('2_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_SMALL',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'232',
                                height:'152',
                                addpanel:[{
                                    key:'1',
                                    videoUrl:'',
                                    imageUrl:'',
                                    uploadloading:false,
                                    btnloading:false,
                                    imgloading:false,
                                    videoshow:false,
                                    covershow:false,
                                    image_id:'',
                                    video_id:'',
                                    videolist:[],
                                    coverlist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    videonum:0,
                                    covernum:0,
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },{
                            title:'大图竖图',
                            img:this.imgurl('16_S.svg'),
                            value:'CREATIVE_IMAGE_MODE_LARGE_VERTICAL',
                            content:{
                                panelshow:true,
                                show:false,
                                num:0,
                                width:'140',
                                height:'250',
                                addpanel:[{
                                    key:'1',
                                    videoUrl:'',
                                    imageUrl:'',
                                    uploadloading:false,
                                    btnloading:false,
                                    imgloading:false,
                                    videoshow:false,
                                    covershow:false,
                                    image_id:'',
                                    video_id:'',
                                    videolist:[],
                                    coverlist:[],
                                    videoactive:'',
                                    coveractive:'',
                                    videonum:0,
                                    covernum:0,
                                }],
                                activeKey:1,
                                newTabIndex: 2,
                            },
                        },
                    ],
                }
                this.originality.push(newtwo);
            }
            this.listNew();
        },
        listNew(){
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            // console.log(this.id);
            // var parems = {"filtering":[
            //     {"field":"id","operator":"EQUALS","value":this.id}
            // ]}
            // 获取计划列表
            // ajaxparems(ADURL,parems).then((res) => {
            //     var result=res.data;
            //     console.log(res);
            //     this.datainfo =result.data.list[0];
            // })
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
            }else{
                advertiser_id = page.advertiser_id;
            }
            //获取行动号召
            var octionparems = {"text_type":'CALL_TO_ACTION'};
            ajaxrequest(advertiser_id, OCTIONTEXT,octionparems).then((res) => {
                var octions=res.data;
                // console.log(octions);
                this.calllist  = octions.data.list;
            })
            
            //获取视频列表
            ajaxrequest(advertiser_id, VIDEOURL,"").then((res) => {
                var videolist=res.data;
                this.videodata =videolist.data.list;
            })

            //获取广告组头像
            // ajaxrequest("1657869217074189", AVATAR,"").then((res) => {
            //     var avaterimg=res.data;
            //     console.log(avaterimg);
            // })

            //获取创意分类
            // var typeparems = {'parent_id':0};
            ajaxparems(INDUSTRY,"").then((res) => {
                var typeresult=res.data;
                if(typeresult.code == "SUCCESS"){
                    this.typelist = typeresult.data;
                }
            })
            this.spinning = false;
        },
        oninventory(e){
            //广告位置
            this.inventory = e.target.value;
        },
        onmaterial(n,e){
            //创意方式
            this.originality[n].material = e.target.value;
        },
        addoriginality(){
            //批量添加素材
            if(this.originality.length >=20){
                return;
            }
            var index = this.originality.length +1;
            this.originality.push({
                key:index,
                creative_material_mode:`creative_material_mode${index}`,
                material:'NONE',
                originname:`name${index}`,
                originvalue:`创意组${index}`,
                program:{
                    imgnum:0,
                    videonum:0,
                },
                customnum:0,
                customactive:"1",
                progractive:'1',
                num:[],
                tabtrue:false,
                videonums:[],
                imagenums:[],
                tabimage:false,
                tabvideo:false,
                videoshow:false,
                input:[{
                    value:'titles1',
                    nametitle:'',
                    dynamicmores:false,
                    dynamiclists:[],
                    words_ids:[],
                }],
                inputnum:1,
                addtitledis:false,
                paneslist:[
                    {
                        title:'竖版视频',
                        img:this.imgurl('15_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'140',
                            height:'250',
                            addpanel:[{
                                title:'创意1',
                                key:'1',
                                videoUrl:'',
                                imageUrl:'',
                                uploadloading:false,
                                btnloading:false,
                                imgloading:false,
                                nametitle:'',
                                image_ids:[],
                                image_id:'',
                                video_id:'',
                                input:'title1',
                                derive_poster_cid:false,
                                videoshow:false,
                                covershow:false,
                                dynamicmore:false,
                                videonum:0,
                                covernum:0,
                                videolist:[],
                                coverlist:[],
                                dynamiclist:[],
                                videoactive:'',
                                coveractive:'',
                                creative_word_ids:[]
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },{
                        title:'横版视频',
                        img:this.imgurl('5_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_VIDEO',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'250',
                            height:'140',
                            addpanel:[{
                                title:'创意1',
                                key:'1',
                                videoUrl:'',
                                imageUrl:'',
                                uploadloading:false,
                                btnloading:false,
                                imgloading:false,
                                nametitle:'',
                                image_ids:[],
                                image_id:'',
                                video_id:'',
                                input:'title1',
                                derive_poster_cid:false,
                                videoshow:false,
                                covershow:false,
                                dynamicmore:false,
                                videonum:0,
                                covernum:0,
                                videolist:[],
                                coverlist:[],
                                dynamiclist:[],
                                videoactive:'',
                                coveractive:'',
                                creative_word_ids:[]
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },{
                        title:'大图横图',
                        img:this.imgurl('3_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_LARGE',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'250',
                            height:'140',
                            addpanel:[{
                                title:'创意1',
                                key:'1',
                                videoUrl:'',
                                imageUrl:'',
                                uploadloading:false,
                                btnloading:false,
                                imgloading:false,
                                nametitle:'',
                                image_ids:[],
                                image_id:'',
                                video_id:'',
                                input:'title1',
                                derive_poster_cid:false,
                                videoshow:false,
                                covershow:false,
                                dynamicmore:false,
                                videonum:0,
                                covernum:0,
                                videolist:[],
                                coverlist:[],
                                dynamiclist:[],
                                videoactive:'',
                                coveractive:'',
                                creative_word_ids:[]
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },{
                        title:'组图',
                        img:this.imgurl('4_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_GROUP',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'178',
                            height:'117',
                            addpanel:[{
                                title:'创意1',
                                key:'1',
                                videoUrl:'',
                                group:[{
                                    img:'',
                                    showis:false,
                                    btnloading:false,
                                    imgloading:false,
                                    nums:0,
                                    activeimg:'',
                                    image_id:'',
                                },{
                                    img:'',
                                    showis:false,
                                    btnloading:false,
                                    imgloading:false,
                                    nums:0,
                                    activeimg:'',
                                    image_id:'',
                                },{
                                    img:'',
                                    showis:false,
                                    btnloading:false,
                                    imgloading:false,
                                    nums:0,
                                    activeimg:'',
                                    image_id:'',
                                }],
                                nametitle:'',
                                image_ids:[],
                                video_id:'',
                                input:'title1',
                                derive_poster_cid:false,
                                videoshow:false,
                                covershow:false,
                                dynamicmore:false,
                                videonum:0,
                                covernum:[],
                                videolist:[],
                                coverlist:[],
                                dynamiclist:[],
                                videoactive:'',
                                coveractive:'',
                                creative_word_ids:[]
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },{
                        title:'小图',
                        img:this.imgurl('2_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_SMALL',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'232',
                            height:'152',
                            addpanel:[{
                                title:'创意1',
                                key:'1',
                                videoUrl:'',
                                imageUrl:'',
                                btnloading:false,
                                imgloading:false,
                                nametitle:'',
                                image_ids:[],
                                image_id:'',
                                video_id:'',
                                input:'title1',
                                derive_poster_cid:false,
                                videoshow:false,
                                covershow:false,
                                dynamicmore:false,
                                videonum:0,
                                covernum:0,
                                videolist:[],
                                coverlist:[],
                                dynamiclist:[],
                                videoactive:'',
                                coveractive:'',
                                creative_word_ids:[]
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },{
                        title:'大图竖图',
                        img:this.imgurl('16_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_LARGE_VERTICAL',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'140',
                            height:'250',
                            addpanel:[{
                                title:'创意1',
                                key:'1',
                                videoUrl:'',
                                imageUrl:'',
                                btnloading:false,
                                imgloading:false,
                                nametitle:'',
                                image_ids:[],
                                image_id:'',
                                video_id:'',
                                input:'title1',
                                derive_poster_cid:false,
                                videoshow:false,
                                covershow:false,
                                dynamicmore:false,
                                videonum:0,
                                covernum:0,
                                videolist:[],
                                coverlist:[],
                                dynamiclist:[],
                                videoactive:'',
                                coveractive:'',
                                creative_word_ids:[]
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },
                ],
                customlist:[
                    {
                        title:'竖版视频',
                        img:this.imgurl('15_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'140',
                            height:'250',
                            addpanel:[{
                                key:'1',
                                videoUrl:'',
                                imageUrl:'',
                                uploadloading:false,
                                btnloading:false,
                                imgloading:false,
                                videoshow:false,
                                covershow:false,
                                image_id:'',
                                video_id:'',
                                videolist:[],
                                coverlist:[],
                                videoactive:'',
                                coveractive:'',
                                videonum:0,
                                covernum:0,
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },{
                        title:'横版视频',
                        img:this.imgurl('5_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_VIDEO',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'250',
                            height:'140',
                            addpanel:[{
                                key:'1',
                                videoUrl:'',
                                imageUrl:'',
                                uploadloading:false,
                                btnloading:false,
                                imgloading:false,
                                videoshow:false,
                                covershow:false,
                                image_id:'',
                                video_id:'',
                                videolist:[],
                                coverlist:[],
                                videoactive:'',
                                coveractive:'',
                                videonum:0,
                                covernum:0,
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },{
                        title:'大图横图',
                        img:this.imgurl('3_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_LARGE',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'250',
                            height:'140',
                            addpanel:[{
                                key:'1',
                                videoUrl:'',
                                imageUrl:'',
                                uploadloading:false,
                                btnloading:false,
                                imgloading:false,
                                videoshow:false,
                                covershow:false,
                                image_id:'',
                                video_id:'',
                                videolist:[],
                                coverlist:[],
                                videoactive:'',
                                coveractive:'',
                                videonum:0,
                                covernum:0,
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },{
                        title:'小图',
                        img:this.imgurl('2_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_SMALL',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'232',
                            height:'152',
                            addpanel:[{
                                key:'1',
                                videoUrl:'',
                                imageUrl:'',
                                uploadloading:false,
                                btnloading:false,
                                imgloading:false,
                                videoshow:false,
                                covershow:false,
                                image_id:'',
                                video_id:'',
                                videolist:[],
                                coverlist:[],
                                videoactive:'',
                                coveractive:'',
                                videonum:0,
                                covernum:0,
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },{
                        title:'大图竖图',
                        img:this.imgurl('16_S.svg'),
                        value:'CREATIVE_IMAGE_MODE_LARGE_VERTICAL',
                        content:{
                            panelshow:true,
                            show:false,
                            num:0,
                            width:'140',
                            height:'250',
                            addpanel:[{
                                key:'1',
                                videoUrl:'',
                                imageUrl:'',
                                uploadloading:false,
                                btnloading:false,
                                imgloading:false,
                                videoshow:false,
                                covershow:false,
                                image_id:'',
                                video_id:'',
                                videolist:[],
                                coverlist:[],
                                videoactive:'',
                                coveractive:'',
                                videonum:0,
                                covernum:0,
                            }],
                            activeKey:1,
                            newTabIndex: 2,
                        },
                    },
                ],
            });
        },
        origindelete(e){
            // 删除定向
            this.originality.splice(this.originality.indexOf(e),1);
        },
        onsource(e){
            //素材添加方式
            this.source = e.target.value;
        },
        addorigin(){
            //点击添加创意
            this.originshow = true;
        },
        addparogr(n,e){
            var u = e-1;
            if(u ==0 || u ==1){
                this.originality[n].videonums.push(1);
            }else{
                this.originality[n].imagenums.push(1);
            }
            this.originality[n].customlist[u].content.num +=1;
            this.originality[n].customlist[u].content.panelshow = false,
            this.originality[n].customlist[u].content.show = true;
        },
        originadd(){
            //程序化添加
            if(this.addlist.length ==9){
                this.originbtn = true;
            }else{
                this.originbtn = false;
            }
            this.addlist.push(this.addlist.length+1);
        },
        addpanel(n,e){
            // 点击添加创意盒子
            var u = e-1;
            this.originindex = n;
            this.originality[n].panalindex = u;
            this.originality[n].paneslist[u].content.panelshow = false;
            this.originality[n].paneslist[u].content.show = true;
            this.originality[n].paneslist[u].content.num +=1;
            this.originality[n].num.push(1);
        },
        onchange(e){
            console.log(e.target.value);
        },
        change(e){
            console.log(e);
            console.log(11);
        },
        onmodeacrive(e){
            //点击竖图类型
            this.modeacrive =e;
        },

        oncustom(n,e){
            //自定义创建
            this.originality[n].customactive = e;
            var u = e-1;
            if(this.originality[n].paneslist[u].content.panelshow == true){
                this.originality[n].paneslist[u].content.panelshow = true;
                this.originality[n].paneslist[u].content.show = false;
            }else{
                this.originality[n].paneslist[u].content.panelshow = false;
                this.originality[n].paneslist[u].content.show = true;
            }
        },
        oncustoms(n,e){
            // 程序化创建
            this.originality[n].progractive = e;
            var u = e-1;
            if(this.originality[n].customlist[u].content.panelshow == true){
                this.originality[n].customlist[u].content.panelshow = true;
                this.originality[n].customlist[u].content.show = false;
            }else{
                this.originality[n].customlist[u].content.panelshow = false;
                this.originality[n].customlist[u].content.show = true;
            }
        },
        callback(key) {
            console.log(key);
        },
        onEdit(targetKey, action) {
            // 删除标签页
            var sub = this.originality[action].customactive-1;
            this.remove(targetKey,sub,action);
        },
        add(n,u) {
            if(this.originality[n].num.length >9){
                this.originality[n].tabtrue = true;
                return;
            }else{
                this.originality[n].tabtrue = false;
            }
            // const width = this
            const activeKey = `${this.originality[n].paneslist[u].content.newTabIndex++}`;
            if(u ==3){
                this.originality[n].paneslist[u].content.addpanel.push({
                    title:`创意${activeKey}`,
                    key:activeKey,
                    videoUrl:'',
                    group:[{
                        img:'',
                        showis:false,
                        btnloading:false,
                        imgloading:false,
                        nums:0,
                        activeimg:'',
                        image_id:'',
                    },{
                        img:'',
                        showis:false,
                        btnloading:false,
                        imgloading:false,
                        nums:0,
                        activeimg:'',
                        image_id:'',
                    },{
                        img:'',
                        showis:false,
                        btnloading:false,
                        imgloading:false,
                        nums:0,
                        activeimg:'',
                        image_id:'',
                    }],
                    nametitle:'',
                    image_ids:[],
                    video_id:'',
                    input:`title${activeKey}`,
                    videoshow:false,
                    covershow:false,
                    dynamicmore:false,
                    videonum:0,
                    covernum:[],
                    videolist:[],
                    coverlist:[],
                    dynamiclist:[],
                    videoactive:'',
                    coveractive:'',
                    creative_word_ids:[]
                });
            }else{
                this.originality[n].paneslist[u].content.addpanel.push({
                    title:`创意${activeKey}`,
                    key:activeKey,
                    videoUrl:'',
                    imageUrl:'',
                    uploadloading:false,
                    btnloading:false,
                    imgloading:false,
                    nametitle:'',
                    image_ids:[],
                    image_id:'',
                    video_id:'',
                    input:`title${activeKey}`,
                    videoshow:false,
                    covershow:false,
                    dynamicmore:false,
                    videonum:0,
                    covernum:0,
                    videolist:[],
                    coverlist:[],
                    dynamiclist:[],
                    videoactive:'',
                    coveractive:'',
                    creative_word_ids:[]
                });
            }
           
            this.originality[n].paneslist[u].content.num+=1;
            this.originality[n].num.push(1);
            this.originality[n].paneslist[u].content.activeKey = activeKey;
        },
        addpush(n,u){
            // 程序化创意追加
            if(u ==0 || u ==1){
                if(this.originality[n].videonums.length >9){
                    this.originality[n].tabvideo = true;
                    return;
                }else{
                    this.originality[n].tabvideo = false;
                }
                this.originality[n].videonums.push(1);
            }else{
                if(this.originality[n].imagenums.length >11){
                    this.originality[n].tabimage = true;
                    return;
                }else{
                    this.originality[n].tabimage = false;
                }
                this.originality[n].imagenums.push(1);
            }
            const activeKey = `${this.originality[n].customlist[u].content.newTabIndex++}`;
            this.originality[n].customlist[u].content.addpanel.push({
                key:activeKey,
                videoUrl:'',
                imageUrl:'',
                uploadloading:false,
                btnloading:false,
                imgloading:false,
                videoshow:false,
                covershow:false,
                image_id:'',
                video_id:'',
                videolist:[],
                coverlist:[],
                videoactive:'',
                coveractive:'',
                videonum:0,
                covernum:0,
            });
            this.originality[n].customlist[u].content.num+=1;
            this.originality[n].customlist[u].content.activeKey = activeKey;
        },
        remove(targetKey,sub,n) {
            if(this.originality[n].num.length <=10){
                this.tabtrue = false;
            }
            let activeKey = this.originality[n].paneslist[sub].content.activeKey;
            let lastIndex;
            this.originality[n].paneslist[sub].content.addpanel.forEach((pane, i) => {
              if (pane.key === targetKey) {
                lastIndex = i - 1;
              }
            });
            const panes = this.originality[n].paneslist[sub].content.addpanel.filter(pane => pane.key !== targetKey);
            if (panes.length && activeKey === targetKey) {
              if (lastIndex >= 0) {
                activeKey = panes[lastIndex].key;
              } else {
                activeKey = panes[0].key;
              }
            }
            this.originality[n].paneslist[sub].content.addpanel = panes;
            this.originality[n].paneslist[sub].content.activeKey = activeKey;
            this.originality[n].paneslist[sub].content.num =this.originality[n].paneslist[sub].content.num -1;
            this.originality[n].paneslist[sub].content.newTabIndex =this.originality[n].paneslist[sub].content.newTabIndex -1;
            this.originality[n].num.splice(-1, 1);
            if(this.originality[n].paneslist[sub].content.addpanel.length ==0){
                this.originality[n].paneslist[sub].content.panelshow =true;
                this.originality[n].paneslist[sub].content.show =false;
                // this.customlist[sub].content.newTabIndex =2;
                this.originality[n].paneslist[sub].content.newTabIndex =2;
                if(sub ==3){
                    this.originality[n].paneslist[sub].content.addpanel = [{
                        title:'创意1',
                        key:'1',
                        videoUrl:'',
                        group:[{
                            img:'',
                            showis:false,
                            btnloading:false,
                            imgloading:false,
                            nums:0,
                            activeimg:'',
                            image_id:'',
                        },{
                            img:'',
                            showis:false,
                            btnloading:false,
                            imgloading:false,
                            nums:0,
                            activeimg:'',
                            image_id:'',
                        },{
                            img:'',
                            showis:false,
                            btnloading:false,
                            imgloading:false,
                            nums:0,
                            activeimg:'',
                            image_id:'',
                        }],
                        nametitle:'',
                        image_ids:[],
                        video_id:'',
                        input:'title1',
                        videoshow:false,
                        covershow:false,
                        dynamicmore:false,
                        videonum:0,
                        covernum:[],
                        videolist:[],
                        coverlist:[],
                        dynamiclist:[],
                        videoactive:'',
                        coveractive:'',
                        creative_word_ids:[]
                    }];
                }else{
                    this.originality[n].paneslist[sub].content.addpanel = [{
                        title:'创意1',
                        key:'1',
                        videoUrl:'',
                        imageUrl:'',
                        uploadloading:false,
                        btnloading:false,
                        imgloading:false,
                        nametitle:'',
                        image_ids:[],
                        image_id:'',
                        video_id:'',
                        input:'title1',
                        videoshow:false,
                        covershow:false,
                        dynamicmore:false,
                        videonum:0,
                        covernum:0,
                        videolist:[],
                        coverlist:[],
                        dynamiclist:[],
                        videoactive:'',
                        coveractive:'',
                        creative_word_ids:[]
                    }];
                }
                
            }
        },
        removepush(n,targetKey,sub){
            // 程序化创意追减
            if(sub ==0 || sub ==1){
                if(this.originality[n].videonums.length <=10){
                    this.originality[n].tabvideo = false;
                }
            }else{
                if(this.originality[n].imagenums.length <=12){
                    this.originality[n].tabimage =false;
                }
            }
            let activeKey = this.originality[n].customlist[sub].content.activeKey;
            let lastIndex;
            this.originality[n].customlist[sub].content.addpanel.forEach((pane, i) => {
              if (pane.key == targetKey) {
                lastIndex = i - 1;
              }
            });
            const panes = this.originality[n].customlist[sub].content.addpanel.filter(pane => pane.key !== targetKey);
            if (panes.length && activeKey === targetKey) {
              if (lastIndex >= 0) {
                activeKey = panes[lastIndex].key;
              } else {
                activeKey = panes[0].key;
              }
            }
            this.originality[n].customlist[sub].content.addpanel = panes;
            this.originality[n].customlist[sub].content.activeKey = activeKey;
            this.originality[n].customlist[sub].content.num =this.originality[n].customlist[sub].content.num -1;
            this.originality[n].customlist[sub].content.newTabIndex =this.originality[n].customlist[sub].content.newTabIndex -1;
            if(sub ==0 || sub==1){
                this.originality[n].videonums.splice(-1, 1);
            }else{
                this.originality[n].imagenums.splice(-1, 1);
            }
            if(this.originality[n].customlist[sub].content.addpanel.length ==0){
                this.originality[n].customlist[sub].content.panelshow =true;
                this.originality[n].customlist[sub].content.show =false;
                this.originality[n].customlist[sub].content.newTabIndex =2;
                this.originality[n].customlist[sub].content.addpanel = [{key:1,
                    videoUrl:'',
                    imageUrl:'',
                    uploadloading:false,
                    btnloading:false,
                    imgloading:false,
                    videoshow:false,
                    covershow:false,
                    image_id:'',
                    video_id:'',
                    videolist:[],
                    coverlist:[],
                    videoactive:'',
                    coveractive:'',
                    videonum:0,
                    covernum:0,
                    input:[{
                        value:'titles1',
                        nametitle:'',
                    }],
                }]
            }
        },
        tabdelete(e,v){
            //删除创意
            var u = v-1;
           if(e ==0){
                var n = Object.keys(this.originshowsnum);
                if(this.originshowsnum[n[u]] ==true){
                    this.originshow = true;
                }else{
                    this.originshow = false;
                }
           }
           var nsn = Object.keys(this.originnum);
          this.originnum[nsn[u]] = this.originnum[nsn[u]] - 1;
           this.tablist.splice(e, 1)
        },
        onoriginality(v){
            if(this.tablist.length ==9){
                this.tabtrue = true;
            }else{
                this.tabtrue = false;
            }
            var u = v-1;
            var nsn = Object.keys(this.originnum);
            this.originnum[nsn[u]] += 1;
            //自定义添加
            this.tablist.push(this.tablist.length+1);
        },
        ontab(e){
            //添加创意
            this.tabactive = e;
        },
        onvideo(n,e){
            // 素材库
            var sub = this.originality[n].customactive-1;
            this.originality[n].paneslist[sub].content.addpanel[e].btnloading = true;
            this.originality[n].paneslist[sub].content.addpanel[e].videoshow = true;
            this.videoloding = true;
            // 根据视频宽高条件筛选
            var viderparems = "";
            if(sub ==0){
                viderparems = {"filtering":{ratio:[0,56]}}
            }else{
                viderparems = {"filtering":{ratio:[1,78]}}
            }
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';

            if(page.type ==3){
                for (let i = 0; i < page.list.length; i++) {

                   ajaxrequest(page.list[i].advertiser_id, VIDEOURL,viderparems).then(async(res) => {
                        var videolist=res.data;
                        if(videolist.code=="SUCCESS"){

                            if(videolist.data.list.length >0){
                                let obj = []
                                videolist.data.list.forEach((item)=>{
                                    if(obj.indexOf(item) === -1){
                                        obj.push(item)
                                    }
                                })
                                this.originality[n].paneslist[sub].content.addpanel[e].videolist = [...obj];
                                this.videoloding = false;
                                this.originality[n].paneslist[sub].content.addpanel[e].btnloading = false;
                            }
                        }else{
                            this.videoloding = false;
                            this.originality[n].paneslist[sub].content.addpanel[e].btnloading = false;
                            this.$message.error(videolist.message,3);
                        }
                    })
                } 
            }else{
                advertiser_id = page.advertiser_id;
                ajaxrequest(advertiser_id, VIDEOURL,viderparems).then((res) => {
                    var videolist=res.data;
                    if(videolist.code=="SUCCESS"){
                        this.originality[n].paneslist[sub].content.addpanel[e].videolist = videolist.data.list;
                        this.videoloding = false;
                        this.originality[n].paneslist[sub].content.addpanel[e].btnloading = false;
                    }else{
                        this.videoloding = false;
                        this.originality[n].paneslist[sub].content.addpanel[e].btnloading = false;
                        this.$message.error(videolist.message,3);
                    }
                })
            }
        },
        metavideo(n,e){
            //程序化点击素材库
            var sub = this.originality[n].progractive -1;
            this.originality[n].customlist[sub].content.addpanel[e].videoshow = true;
            this.originality[n].customlist[sub].content.addpanel[e].btnloading = true;
            this.videoloding = true;
            var viderparems = {};
            if(sub ==0){
                viderparems = {"filtering":{ratio:[0,56]}}
            }else{
                viderparems = {"filtering":{ratio:[1,78]}}
            }
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                // advertiser_id= page.list[0].advertiser_id;
                for (let i = 0; i < page.list.length; i++) {
                    ajaxrequest(page.list[i].advertiser_id, VIDEOURL,viderparems).then(async(res) => {
                         var videolist=res.data;
                         if(videolist.code=="SUCCESS"){
                             if(videolist.data.list.length >0){
                                let obj = []
                                videolist.data.list.forEach((item)=>{
                                    if(obj.indexOf(item) === -1){
                                        obj.push(item)
                                    }
                                })
                                this.originality[n].customlist[sub].content.addpanel[e].videolist = [...obj];
                             }
                         }else{
                             this.$message.error(videolist.message,3);
                         }
                     })
                 } 
                 this.videoloding = false;
                 this.originality[n].customlist[sub].content.addpanel[e].btnloading = false;

            }else{
                advertiser_id = page.advertiser_id;
                ajaxrequest(advertiser_id, VIDEOURL,viderparems).then((res) => {
                    var videolist=res.data;
                    // console.log(videolist);
                    if(videolist.code=="SUCCESS"){
                        this.originality[n].customlist[sub].content.addpanel[e].videolist = videolist.data.list;
                        this.videoloding = false;
                        this.originality[n].customlist[sub].content.addpanel[e].btnloading = false;
                    }else{
                        this.videoloding = false;
                        this.originality[n].customlist[sub].content.addpanel[e].btnloading = false;
                        this.$message.error(videolist.message,3);
                    }
                })
            }
        },
        handlevideo(n,e){
            // 素材库取消
            var sub = this.originality[n].customactive-1;
            this.originality[n].paneslist[sub].content.addpanel[e].videoshow = false;
        },
        handlevideos(n,e){
            // 程序化素材库取消
            var sub =this.originality[n].progractive -1;
            this.originality[n].customlist[sub].content.addpanel[e].videoshow = false; 
        },
        sourceserach(){
            //视频关键词搜索
        },
        onallsource(){
            // 全部来源
        },
        onvideoactive(n,i,e){
            // 选择视频
            var sub = this.originality[n].customactive-1;
            if(this.originality[n].paneslist[sub].content.addpanel[i].videoactive == e){
                this.originality[n].paneslist[sub].content.addpanel[i].videoactive = '';
                this.originality[n].paneslist[sub].content.addpanel[i].videonum =this.originality[n].paneslist[sub].content.addpanel[i].videonum -1;
            }else{
                this.originality[n].paneslist[sub].content.addpanel[i].videoactive = e;
                this.originality[n].paneslist[sub].content.addpanel[i].videonum =1;
            }
        },
        onvideoactives(n,i,e){
            // 程序化选择视频
            var sub = this.originality[n].progractive-1;
            if(this.originality[n].customlist[sub].content.addpanel[i].videoactive == e){
                this.originality[n].customlist[sub].content.addpanel[i].videoactive = '';
                this.originality[n].customlist[sub].content.addpanel[i].videonum =this.originality[n].customlist[sub].content.addpanel[i].videonum -1;
            }else{
                this.originality[n].customlist[sub].content.addpanel[i].videoactive = e;
                this.originality[n].customlist[sub].content.addpanel[i].videonum =1;
            }
        },
        oncoveractive(n,i,e){
            //选择封面图
            var sub = this.originality[n].customactive-1;
            if(this.originality[n].paneslist[sub].content.addpanel[i].coveractive == e){
                this.originality[n].paneslist[sub].content.addpanel[i].coveractive = '';
                this.originality[n].paneslist[sub].content.addpanel[i].covernum =this.originality[n].paneslist[sub].content.addpanel[i].covernum -1;
            }else{
                this.originality[n].paneslist[sub].content.addpanel[i].coveractive = e;
                this.originality[n].paneslist[sub].content.addpanel[i].covernum =1;
            }
        },

        onvideocoveractive(n,i,e){
            //选择封面
            var sub = this.originality[n].customactive-1;
            if(this.originality[n].paneslist[sub].content.addpanel[i].coveractive == e){
                this.originality[n].paneslist[sub].content.addpanel[i].coveractive = '';
                this.originality[n].paneslist[sub].content.addpanel[i].covernum =this.originality[n].paneslist[sub].content.addpanel[i].covernum -1;
            }else{
                this.originality[n].paneslist[sub].content.addpanel[i].coveractive = e;
                this.originality[n].paneslist[sub].content.addpanel[i].covernum =1;
            }
        },
        oncoveractives(n,i,e){
            //程序化选择视频
            var sub = this.originality[n].progractive-1;
            if(this.originality[n].customlist[sub].content.addpanel[i].coveractive == e){
                this.originality[n].customlist[sub].content.addpanel[i].coveractive = '';
                this.originality[n].customlist[sub].content.addpanel[i].covernum =this.originality[n].customlist[sub].content.addpanel[i].covernum -1;
            }else{
                this.originality[n].customlist[sub].content.addpanel[i].coveractive = e;
                this.originality[n].customlist[sub].content.addpanel[i].covernum =1;
            }
        },

        
        onvideocoveractives(n,i,e){
            //选择封面
            var sub = this.originality[n].progractive-1;
            if(this.originality[n].customlist[sub].content.addpanel[i].coveractive == e){
                this.originality[n].customlist[sub].content.addpanel[i].coveractive = '';
                this.originality[n].customlist[sub].content.addpanel[i].covernum =this.originality[n].customlist[sub].content.addpanel[i].covernum -1;
            }else{
                this.originality[n].customlist[sub].content.addpanel[i].coveractive = e;
                this.originality[n].customlist[sub].content.addpanel[i].covernum =1;
            }
        },

        oncoveractiveGroup(m,i,e,n){
            // 组图选择封面图
            var sub = this.originality[m].customactive-1;
            if(this.originality[m].paneslist[sub].content.addpanel[i].group[n].activeimg == e){
                this.originality[m].paneslist[sub].content.addpanel[i].group[n].activeimg = '';
                this.originality[m].paneslist[sub].content.addpanel[i].group[n].nums =this.originality[m].paneslist[sub].content.addpanel[i].group[n].nums -1;
            }else{
                this.originality[m].paneslist[sub].content.addpanel[i].group[n].activeimg = e;
                this.originality[m].paneslist[sub].content.addpanel[i].group[n].nums =1;
            }
        },
        customRequest(data) {
            // 上传
            var nv = data.data.n;//创意下标
            var i = data.data.index;//创意下数组下标
            var sub = parseInt(data.data.sub)-1;//素材下标
            var uptype = data.data.uptype;//上传的类型
            // 竖版视频
            if(sub ==1){
                // 竖版视频
                if(uptype ==1){
                    const isJpgOrPng = data.file.type === 'video/mp4' || data.file.type === 'video/mpeg' || data.file.type === 'video/3gp' || data.file.type === 'video/avi';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 100;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤100M');
                      return;
                    }
                }
                //封面图
                if(uptype ==2){
                    const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1.5M');
                      return;
                    }
                }
            }else if(sub ==2){
                // 横版视频
                if(uptype ==1){
                    const isJpgOrPng = data.file.type === 'video/mp4' || data.file.type === 'video/mpeg' || data.file.type === 'video/3gp' || data.file.type === 'video/avi';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1000;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1000M');
                      return;
                    }
                }
                //封面图
                if(uptype ==2){
                    const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1.5M');
                      return;
                    }
                }
            }else{
                // 图片上传
                if(uptype ==2){
                    const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1.5M');
                      return;
                    }
                }
            }

            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
            }else{
                advertiser_id = page.advertiser_id;
            }

            const formData = new FormData()
            formData.append('file', data.file)
            formData.append('account_id', advertiser_id)//随便写一个示例
           if(uptype ==1){
                // 视频上传
                ajaxfile(UPLOADVIDEO,formData).then((res) => {
                    var result=res.data;
                    if(result.code =='SUCCESS'){
                        this.originality[nv].paneslist[sub].content.addpanel[i].videoUrl = result.data.video_url;
                        this.originality[nv].paneslist[sub].content.addpanel[i].video_id = result.data.video_id;
                    }
                    this.$message.success(result.message,3);
                });
            }else{
                 // 图片上传
                 ajaxfile(UPLOADCOVER,formData).then((res) => {
                    var result=res.data;
                    if(result.code =='SUCCESS'){
                        if(sub ==3){
                            var n = data.data.group;
                            this.originality[nv].paneslist[sub].content.addpanel[i].group[n].img = result.data.url;
                            this.originality[nv].paneslist[sub].content.addpanel[i].group[n].image_id = result.data.id;
                        }else{
                            this.originality[nv].paneslist[sub].content.addpanel[i].imageUrl = result.data.url;
                            this.originality[nv].paneslist[sub].content.addpanel[i].image_id = result.data.id;
                        }
                        this.$message.success(result.message,3);
                    }
                });
            }
        },
        paogrRequest(data){
            // 程序化上传
             // 上传
             var nv = data.data.n;
             var i = data.data.index;//创意下标
             var sub = parseInt(data.data.sub)-1;//素材下标
             var uptype = data.data.uptype;//上传的类型

            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
            }else{
                advertiser_id = page.advertiser_id;
            }

             // 竖版视频
             if(sub ==1){
                 // 竖版视频
                 if(uptype ==1){
                     const isJpgOrPng = data.file.type === 'video/mp4' || data.file.type === 'video/mpeg' || data.file.type === 'video/3gp' || data.file.type === 'video/avi';
                     if (!isJpgOrPng) {
                         this.$message.error('上传格式有误!');
                         return;
                     }
                     const isLt2M = data.file.size / 1024 / 1024 < 100;
                     if (!isLt2M) {
                       this.$message.error('超出上传大小≤100M');
                       return;
                     }
                 }
                 //封面图
                 if(uptype ==2){
                     const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                     if (!isJpgOrPng) {
                         this.$message.error('上传格式有误!');
                         return;
                     }
                     const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                     if (!isLt2M) {
                       this.$message.error('超出上传大小≤1.5M');
                       return;
                     }
                 }
             }else if(sub ==2){
                 // 横版视频
                 if(uptype ==1){
                     const isJpgOrPng = data.file.type === 'video/mp4' || data.file.type === 'video/mpeg' || data.file.type === 'video/3gp' || data.file.type === 'video/avi';
                     if (!isJpgOrPng) {
                         this.$message.error('上传格式有误!');
                         return;
                     }
                     const isLt2M = data.file.size / 1024 / 1024 < 1000;
                     if (!isLt2M) {
                       this.$message.error('超出上传大小≤1000M');
                       return;
                     }
                 }
                 //封面图
                 if(uptype ==2){
                     const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                     if (!isJpgOrPng) {
                         this.$message.error('上传格式有误!');
                         return;
                     }
                     const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                     if (!isLt2M) {
                       this.$message.error('超出上传大小≤1.5M');
                       return;
                     }
                 }
             }else{
                 // 图片上传
                 if(uptype ==2){
                     const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                     if (!isJpgOrPng) {
                         this.$message.error('上传格式有误!');
                         return;
                     }
                     const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                     if (!isLt2M) {
                       this.$message.error('超出上传大小≤1.5M');
                       return;
                     }
                 }
             }


             const formData = new FormData()
             formData.append('file', data.file)
             formData.append('account_id', advertiser_id)//随便写一个示例
            if(uptype ==1){
                 // 视频上传
                 ajaxfile(UPLOADVIDEO,formData).then((res) => {
                     var result=res.data;
                     if(result.code =='SUCCESS'){
                         this.$message.success(result.message,3);
                         this.originality[nv].customlist[sub].content.addpanel[i].videoUrl = result.data.video_url;
                         this.originality[nv].customlist[sub].content.addpanel[i].video_id = result.data.video_id;
                     }else{
                         this.$message.error(result.message,3);
                     }
                 });
             }else{
                  // 图片上传
                  ajaxfile(UPLOADCOVER,formData).then((res) => {
                     var result=res.data;
                     if(result.code =='SUCCESS'){
                        this.$message.success(result.message,3);
                        this.originality[nv].customlist[sub].content.addpanel[i].imageUrl = result.data.url;
                        this.originality[nv].customlist[sub].content.addpanel[i].image_id = result.data.id;
                     }else{
                        this.$message.error(result.message,3);
                     }
                 });
             }
        },
        modecustomRequest(data){
            var nv = data.data.n;
            var i = data.data.index;//创意下标
            var sub = parseInt(data.data.sub)-1;//素材下标
           
            var uptype = data.data.uptype;//上传的类型
            console.log(uptype);
             // 竖版视频
             if(sub ==1){
                // 竖版视频
                if(uptype ==1){
                    const isJpgOrPng = data.file.type === 'video/mp4' || data.file.type === 'video/mpeg' || data.file.type === 'video/3gp' || data.file.type === 'video/avi';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 100;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤100M');
                      return;
                    }
                }
                //封面图
                if(uptype ==2){
                    const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1.5M');
                      return;
                    }
                }
            }else if(sub ==2){
                // 横版视频
                if(uptype ==1){
                    const isJpgOrPng = data.file.type === 'video/mp4' || data.file.type === 'video/mpeg' || data.file.type === 'video/3gp' || data.file.type === 'video/avi';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1000;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1000M');
                      return;
                    }
                }
                //封面图
                if(uptype ==2){
                    const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1.5M');
                      return;
                    }
                }
            }else{
                // 图片上传
                if(uptype ==2){
                    const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1.5M');
                      return;
                    }
                }
            }

            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
            }else{
                advertiser_id = page.advertiser_id;
            }

            const formData = new FormData()
            formData.append('file', data.file)
            formData.append('account_id', advertiser_id)//随便写一个示例

           if(uptype ==1){
                // 视频上传
                ajaxfile(UPLOADVIDEO,formData).then((res) => {
                    var result=res.data;
                    if(result.code =='SUCCESS'){
                        this.$message.success("上传成功",3);
                        this.originality[nv].paneslist[sub].content.addpanel[i].videoUrl = result.data.video_url;
                        this.originality[nv].paneslist[sub].content.addpanel[i].video_id = result.data.video_id;
                        this.originality[nv].paneslist[sub].content.addpanel[i].videoshow = false;
                        this.originality[nv].paneslist[sub].content.addpanel[i].uploadloading = false;
                        // this.originality[nv].paneslist[sub].content.addpanel[i].covershow = false;
                    }else{
                        this.originality[nv].paneslist[sub].content.addpanel[i].videoshow = false;
                        this.originality[nv].paneslist[sub].content.addpanel[i].uploadloading = false;
                        // this.originality[nv].paneslist[sub].content.addpanel[i].covershow = false;
                        this.$message.error(result.message,3);
                    }
                });
               
            }else{
                 // 图片上传
                 ajaxfile(UPLOADCOVER,formData).then((res) => {
                    var result=res.data;
                    if(result.code =='SUCCESS'){
                        this.$message.success("上传成功",3);
                        if(sub ==3){
                            var n = data.data.group;
                            this.originality[nv].paneslist[sub].content.addpanel[i].group[n].img = result.data.url;
                            this.originality[nv].paneslist[sub].content.addpanel[i].group[n].image_id = result.data.id;
                        }else{
                            this.originality[nv].paneslist[sub].content.addpanel[i].imageUrl = result.data.url;
                            this.originality[nv].paneslist[sub].content.addpanel[i].image_id = result.data.id;
                        }
                        // this.originality[nv].paneslist[sub].content.addpanel[i].videoshow = false;
                        this.originality[nv].paneslist[sub].content.addpanel[i].covershow = false;
                        this.originality[nv].paneslist[sub].content.addpanel[i].imgloading = false;
                    }else{
                        // this.originality[nv].paneslist[sub].content.addpanel[i].videoshow = false;
                        this.originality[nv].paneslist[sub].content.addpanel[i].covershow = false;
                        this.originality[nv].paneslist[sub].content.addpanel[i].imgloading = false;
                        this.$message.error(result.message,3);
                    }
                });
            }
        },
        modepaogrRequest(data){
            var nv = data.data.n;
            var i = data.data.index;//创意下标
            var sub = parseInt(data.data.sub)-1;//素材下标
            var uptype = data.data.uptype;//上传的类型
             // 竖版视频
             if(sub ==1){
                // 竖版视频
                if(uptype ==1){
                    const isJpgOrPng = data.file.type === 'video/mp4' || data.file.type === 'video/mpeg' || data.file.type === 'video/3gp' || data.file.type === 'video/avi';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 100;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤100M');
                      return;
                    }
                }
                //封面图
                if(uptype ==2){
                    const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1.5M');
                      return;
                    }
                }
            }else if(sub ==2){
                // 横版视频
                if(uptype ==1){
                    const isJpgOrPng = data.file.type === 'video/mp4' || data.file.type === 'video/mpeg' || data.file.type === 'video/3gp' || data.file.type === 'video/avi';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1000;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1000M');
                      return;
                    }
                }
                //封面图
                if(uptype ==2){
                    const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1.5M');
                      return;
                    }
                }
            }else{
                // 图片上传
                if(uptype ==2){
                    const isJpgOrPng = data.file.type === 'image/jpg' || data.file.type === 'image/jpeg' || data.file.type === 'image/png';
                    if (!isJpgOrPng) {
                        this.$message.error('上传格式有误!');
                        return;
                    }
                    const isLt2M = data.file.size / 1024 / 1024 < 1.5;
                    if (!isLt2M) {
                      this.$message.error('超出上传大小≤1.5M');
                      return;
                    }
                }
            }

            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
            }else{
                advertiser_id = page.advertiser_id;
            }

            const formData = new FormData()
            formData.append('file', data.file)
            formData.append('account_id', advertiser_id)//随便写一个示例
           if(uptype ==1){
                // 视频上传
                ajaxfile(UPLOADVIDEO,formData).then((res) => {
                    var result=res.data;
                    if(result.code =='SUCCESS'){
                        this.$message.success("上传成功",3);
                        this.originality[nv].customlist[sub].content.addpanel[i].videoUrl = result.data.video_url;
                        this.originality[nv].customlist[sub].content.addpanel[i].video_id = result.data.video_id;
                        // this.originality[nv].paneslist[sub].content.addpanel[i].covershow = false;
                        this.originality[nv].customlist[sub].content.addpanel[i].videoshow = false;
                        this.originality[nv].customlist[sub].content.addpanel[i].uploadloading = false;
                    }else{
                        this.originality[nv].customlist[sub].content.addpanel[i].videoshow = false;
                        this.originality[nv].customlist[sub].content.addpanel[i].uploadloading = false;
                        this.$message.error(result.message,3);
                    }
                });
            }else{
                 // 图片上传
                 ajaxfile(UPLOADCOVER,formData).then((res) => {
                    var result=res.data;
                    if(result.code =='SUCCESS'){
                        this.$message.success("上传成功",3);
                        this.originality[nv].customlist[sub].content.addpanel[i].imageUrl = result.data.url;
                        this.originality[nv].customlist[sub].content.addpanel[i].image_id = result.data.id;
                        this.originality[nv].customlist[sub].content.addpanel[i].covershow = false;
                        this.originality[nv].customlist[sub].content.addpanel[i].imgloading = false;
                    }else{
                        this.originality[nv].customlist[sub].content.addpanel[i].covershow = false;
                        this.originality[nv].customlist[sub].content.addpanel[i].imgloading = false;
                        this.$message.error(result.message,3);
                    }
                });
            }
        },
        onuploadcardimg(data){
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
            }else{
                advertiser_id = page.advertiser_id;
            }
            //卡片上传图片
            const formData = new FormData()
            formData.append('file', data.file)
            formData.append('account_id', advertiser_id)//随便写一个示例
            ajaxfile(UPLOADCOVER,formData).then((res) => {
                var result=res.data;
                if(result.code =='SUCCESS'){
                    this.$message.success("上传成功",3);
                    this.cardboximg = result.data.url;
                }else{
                    this.$message.error(result.message,3);
                }
            });
        },
        //自定义上传状态
        videoChange(nv,i,info){
            var sub = this.originality[nv].customactive-1;
            // 上传视频状态加载
            if(info.file.status == "uploading"){
                this.originality[nv].paneslist[sub].content.addpanel[i].uploadloading = true;
                return;
            }
            if (info.file.status === 'done') {
                this.originality[nv].paneslist[sub].content.addpanel[i].uploadloading = false;
            }
        },

       coverChange(nv,i,info){
            var sub = this.originality[nv].customactive-1;
            // 上传图片状态加载
            if(info.file.status == "uploading"){
                this.originality[nv].paneslist[sub].content.addpanel[i].imgloading = true;
                return;
            }
            if (info.file.status === 'done') {
                this.originality[nv].paneslist[sub].content.addpanel[i].imgloading = false;
            }
        },

        covergroupChange(nv,i,index,info){
            // 组图上传状态
            var sub = this.originality[nv].customactive-1;
            this.originality[nv].paneslist[sub].content.addpanel[i].group[index].showis = true;

            if(info.file.status == "uploading"){
                this.originality[nv].paneslist[sub].content.addpanel[i].group[index].imgloading = true;
                return;
            }
            if (info.file.status === 'done') {
                this.originality[nv].paneslist[sub].content.addpanel[i].group[index].imgloading = false;
            }
        },

        //程序化上传状态

        videoChanges(nv,i,info){
            var sub = this.originality[nv].progractive-1;
            // 上传图片状态加载
            if(info.file.status == "uploading"){
                this.originality[nv].customlist[sub].content.addpanel[i].uploadloading = true;
                return;
            }
            if (info.file.status === 'done') {
                this.originality[nv].customlist[sub].content.addpanel[i].uploadloading = false;
            }
        },
        coverChanges(nv,i,info){
            var sub = this.originality[nv].progractive-1;
            // 上传图片状态加载
            if(info.file.status == "uploading"){
                this.originality[nv].customlist[sub].content.addpanel[i].imgloading = true;
                return;
            }
            if (info.file.status === 'done') {
                this.originality[nv].customlist[sub].content.addpanel[i].imgloading = false;
            }
        },

        


        videook(n,i){
            this.confirmLoading = true;
            // 视频弹窗确定
            var sub = this.originality[n].customactive-1;
            if(this.originality[n].paneslist[sub].content.addpanel[i].videonum ==0){
                this.$message.error('请先选择视频',3);
               return;//仍然阻止不了模态窗关闭
            }
            var video = this.originality[n].paneslist[sub].content.addpanel[i].videoactive;
            
            this.originality[n].paneslist[sub].content.addpanel[i].videoshow = false;
            this.originality[n].paneslist[sub].content.addpanel[i].videoUrl = video.url;
            this.originality[n].paneslist[sub].content.addpanel[i].video_id = video.id;
            this.confirmLoading = false;
                   

                // for (let i = 0; i < page.list.advertiser_id.length; i++) {
                //     ajaxrequest(page.advertiser_id[i], VIDEOURL,viderparems).then(async(res) => {
                //          var videolist=res.data;

                //          if(videolist.code=="SUCCESS"){
                //              if(videolist.data.list.length >0){
                //                  videolist.data.list.forEach((item)=>{
                //                      this.originality[n].paneslist[sub].content.addpanel[e].videolist.push(item);
                //                  })
                //              }
                //          }else{
                //              this.$message.error(videolist.message,3);
                //          }
                //      })
                //  } 
                //  this.videoloding = false;

         
        },
        videooks(n,i){
            this.confirmLoading = true;
            // 程序化视频弹窗确定
            var sub = this.originality[n].progractive-1;
            if(this.originality[n].customlist[sub].content.addpanel[i].videonum ==0){
                this.$message.error('请先选择视频',3);
               return;//仍然阻止不了模态窗关闭
            }
            var video = this.originality[n].customlist[sub].content.addpanel[i].videoactive;
            this.originality[n].customlist[sub].content.addpanel[i].videoshow = false;
            this.originality[n].customlist[sub].content.addpanel[i].videoUrl = video.url;
            this.originality[n].customlist[sub].content.addpanel[i].video_id = video.id;
            this.confirmLoading = false;
        },

        oncover(n,i){
            // 上传封面图
            var sub = this.originality[n].customactive-1;
            this.originality[n].paneslist[sub].content.addpanel[i].covershow = true;
            this.originality[n].paneslist[sub].content.addpanel[i].btnloading = true;
            this.coverloding = true;
            var coverparems = "";
            if(sub ==0){
                coverparems = {filtering:{width:720,height:1280}}
            }else if(sub ==1){
                coverparems = {filtering:{width:1280,height:720}}
            }else if(sub ==2){
                coverparems = {filtering:{width:1280,height:720}}
            }else if(sub ==3){
                coverparems = {filtering:{width:456,height:300}}
            }else if(sub ==4){
                coverparems = {filtering:{width:456,height:300}}
            }else if(sub ==5){
                coverparems = {filtering:{width:720,height:1280}}
            }else{
                coverparems = {filtering:{width:720,height:1280}}
            }
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                // advertiser_id= page.list[0].advertiser_id;
                for (let a = 0; a < page.list.length; a++) {

                    ajaxrequest(page.list[a].advertiser_id, IMGLIST,coverparems).then(async(res) => {
                         var coverlist=res.data;
                         if(coverlist.code=="SUCCESS"){
                            let obj = []
                            if(coverlist.data.list.length >0){
                                coverlist.data.list.forEach((item)=>{
                                    if(obj.indexOf(item) === -1){
                                        obj.push(item)
                                    }
                                })  
                            }
                            this.coverloding = false;
                            this.originality[n].paneslist[sub].content.addpanel[i].btnloading = false;
                            this.originality[n].paneslist[sub].content.addpanel[i].coverlist = [...obj];
                         }else{
                            this.coverloding = false;
                            this.originality[n].paneslist[sub].content.addpanel[i].btnloading = false;
                             this.$message.error(coverlist.message,3);
                         }
                     })
                 } 

            }else{
                advertiser_id = page.advertiser_id;
                ajaxrequest(advertiser_id, IMGLIST,coverparems).then((res) => {
                    var coverlist=res.data;
                    if(coverlist.code=="SUCCESS"){
                        this.originality[n].paneslist[sub].content.addpanel[i].coverlist = coverlist.data.list;
                        this.coverloding = false;
                        this.originality[n].paneslist[sub].content.addpanel[i].btnloading = false;
                    }else{
                        this.coverloding = false;
                        this.originality[n].paneslist[sub].content.addpanel[i].btnloading = false;
                        this.$message.error(coverlist.message,3);
                    }
                })
            }
        },

        onvideocover(n,i){
            this.coverloding = true;
            //视频封面
            var sub = this.originality[n].customactive-1;
            this.originality[n].paneslist[sub].content.addpanel[i].btnloading = true;
            var coverparems = this.originality[n].paneslist[sub].content.addpanel[i].video_id;
            if(coverparems ==""){
                this.coverloding = false;
                this.$message.error('先上传视频才能启用自动生成封面功能');
                return;
            }
            this.originality[n].paneslist[sub].content.addpanel[i].covershow = true;
        
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';

            if(page.type ==3){

                for (let a = 0; a < page.list.length; a++) {
                    if(sub ==0){
                        coverparems = {advertiser_id:page.list[a].advertiser_id,video_id:this.originality[n].paneslist[sub].content.addpanel[i].video_id,width:720,height:1280};
                    }else{
                        coverparems = {advertiser_id:page.list[a].advertiser_id,video_id:this.originality[n].paneslist[sub].content.addpanel[i].video_id,width:1280,height:720};
                    }

                    ajaxrequest(page.list[a].advertiser_id, VIDEOCOVER,coverparems).then(async(res) => {
                         var coverlist=res.data;
                         if(coverlist.code=="SUCCESS"){
                             if(coverlist.data.list.length >0){

                                let obj = []
                                coverlist.data.list.forEach((item)=>{
                                    if(obj.indexOf(item) === -1){
                                        obj.push(item)
                                    }
                                })
                                this.originality[n].paneslist[sub].content.addpanel[i].coverlist = [...obj];
                             }
                             this.coverloding = false;
                             this.originality[n].paneslist[sub].content.addpanel[i].btnloading = false;
                         }else{
                            this.coverloding = false;
                            this.originality[n].paneslist[sub].content.addpanel[i].btnloading = false;
                             this.$message.error(coverlist.message,3);
                         }
                     })
                 } 
                
            }else{
                advertiser_id = page.advertiser_id;
                if(sub ==0){
                    coverparems = {advertiser_id:page.advertiser_id,video_id:this.originality[n].paneslist[sub].content.addpanel[i].video_id,width:720,height:1280};
                }else{
                    coverparems = {advertiser_id:page.advertiser_id,video_id:this.originality[n].paneslist[sub].content.addpanel[i].video_id,width:1280,height:720};
                }
                ajaxrequest(advertiser_id, VIDEOCOVER,coverparems).then((res) => {
                    var coverlist=res.data;
                    if(coverlist.code=="SUCCESS"){
                        this.originality[n].paneslist[sub].content.addpanel[i].coverlist = coverlist.data.list;
                        this.coverloding = false;
                        this.originality[n].paneslist[sub].content.addpanel[i].btnloading = false;
                    }else{
                        this.coverloding = false;
                        this.originality[n].paneslist[sub].content.addpanel[i].btnloading = false;
                        this.$message.error(coverlist.message,3);
                    }
                })
            }
        },

        metaimage(n,i){
            // 程序化上传封面图
            var sub = this.originality[n].progractive-1;
            this.originality[n].customlist[sub].content.addpanel[i].covershow = true;
            this.originality[n].customlist[sub].content.addpanel[i].btnloading = true;
            this.coverloding = true;
            var coverparems = "";
            if(sub ==0){
                coverparems = {filtering:{width:720,height:1280}}
            }else if(sub ==1){
                coverparems = {filtering:{width:1280,height:720}}
            }else if(sub ==2){
                coverparems = {filtering:{width:1280,height:720}}
            }else if(sub ==3){
                coverparems = {filtering:{width:456,height:300}}
            }else if(sub ==4){
                coverparems = {filtering:{width:456,height:300}}
            }else if(sub ==5){
                coverparems = {filtering:{width:720,height:1280}}
            }else{
                coverparems = {filtering:{width:720,height:1280}}
            }

            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
                for (let a = 0; a < page.list.length; a++) {
                    ajaxrequest(page.list[a].advertiser_id, IMGLIST,coverparems).then(async(res) => {
                         var coverlist=res.data;
                         if(coverlist.code=="SUCCESS"){
                             if(coverlist.data.list.length >0){
                                let obj = []
                                coverlist.data.list.forEach((item)=>{
                                    if(obj.indexOf(item) === -1){
                                        obj.push(item)
                                    }
                                })
                                this.originality[n].customlist[sub].content.addpanel[i].coverlist =[...obj];
                             }
                             this.coverloding = false;
                             this.originality[n].customlist[sub].content.addpanel[i].btnloading = false;
                         }else{
                            this.coverloding = false;
                            this.originality[n].customlist[sub].content.addpanel[i].btnloading = false;
                             this.$message.error(coverlist.message,3);
                         }
                     })
                }
            }else{
                advertiser_id = page.advertiser_id;
                ajaxrequest(advertiser_id, IMGLIST,coverparems).then((res) => {
                    var coverlist=res.data;
                    if(coverlist.code=="SUCCESS"){
                        this.originality[n].customlist[sub].content.addpanel[i].coverlist = coverlist.data.list;
                        this.coverloding = false;
                        this.originality[n].customlist[sub].content.addpanel[i].btnloading = false;
                    }else{
                        this.coverloding = false;
                        this.originality[n].customlist[sub].content.addpanel[i].btnloading = false;
                        this.$message.error(coverlist.message,3);
                    }
                })
            }
        },

        metavideoimage(n,i){
            this.coverloding = true;
            //视频封面
            var sub = this.originality[n].customactive-1;
            this.originality[n].customlist[sub].content.addpanel[i].btnloading = true;
            var coverparems = this.originality[n].customlist[sub].content.addpanel[i].video_id;
            if(coverparems ==""){
                this.coverloding = false;
                this.$message.error('先上传视频才能启用自动生成封面功能');
                return;
            }
            this.originality[n].customlist[sub].content.addpanel[i].covershow = true;
        
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';

            if(page.type ==3){
                // advertiser_id= page.list[0].advertiser_id;
                for (let a = 0; a < page.list.length; a++) {
                    if(sub ==0){
                        coverparems = {advertiser_id:page.list[a].advertiser_id,video_id:this.originality[n].customlist[sub].content.addpanel[i].video_id,width:720,height:1280};
                    }else{
                        coverparems = {advertiser_id:page.list[a].advertiser_id,video_id:this.originality[n].customlist[sub].content.addpanel[i].video_id,width:1280,height:720};
                    }

                    ajaxrequest(page.list[a].advertiser_id, VIDEOCOVER,coverparems).then(async(res) => {
                         var coverlist=res.data;
                         if(coverlist.code=="SUCCESS"){
                             if(coverlist.data.list.length >0){

                                let obj = []
                                coverlist.data.list.forEach((item)=>{
                                    if(obj.indexOf(item) === -1){
                                        obj.push(item)
                                    }
                                })
                                this.originality[n].customlist[sub].content.addpanel[i].coverlist =[...obj];
                             }
                             this.coverloding = false;
                             this.originality[n].customlist[sub].content.addpanel[i].btnloading = false;
                         }else{
                            this.coverloding = false;
                            this.originality[n].customlist[sub].content.addpanel[i].btnloading = false;
                             this.$message.error(coverlist.message,3);
                         }
                     })
                 } 
                
            }else{
                advertiser_id = page.advertiser_id;
                if(sub ==0){
                    coverparems = {advertiser_id:page.advertiser_id,video_id:this.originality[n].customlist[sub].content.addpanel[i].video_id,width:720,height:1280};
                }else{
                    coverparems = {advertiser_id:page.advertiser_id,video_id:this.originality[n].customlist[sub].content.addpanel[i].video_id,width:1280,height:720};
                }
                ajaxrequest(advertiser_id, VIDEOCOVER,coverparems).then((res) => {
                    var coverlist=res.data;
                    if(coverlist.code=="SUCCESS"){
                        this.originality[n].customlist[sub].content.addpanel[i].coverlist = coverlist.data.list;
                        this.coverloding = false;
                        this.originality[n].customlist[sub].content.addpanel[i].btnloading = false;
                    }else{
                        this.coverloding = false;
                        this.originality[n].customlist[sub].content.addpanel[i].btnloading = false;
                        this.$message.error(coverlist.message,3);
                    }
                })
            }
        },

        async oncoverGroup(n,i,index){
            this.coverloding = true;
            // 组图
            var sub = this.originality[n].customactive-1;
            this.originality[n].paneslist[sub].content.addpanel[i].group[index].showis = true;

            var coverparems = {filtering:{width:456,height:300}}
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                for (let a = 0; a < page.list.length; a++) {
                    await ajaxrequest(page.list[a].advertiser_id, IMGLIST,coverparems).then((res) => {
                         var coverlist=res.data;
                         if(coverlist.code=="SUCCESS"){
                             if(coverlist.data.list.length >0){
                                let obj = []
                                coverlist.data.list.forEach((item)=>{
                                    if(obj.indexOf(item) === -1){
                                        obj.push(item)
                                    }
                                })
                                this.coverloding = false;
                                this.originality[n].paneslist[sub].content.addpanel[i].coverlist =[...obj];
                             }
                         }else{
                            this.coverloding = false;
                             this.$message.error(coverlist.message,3);
                         }
                     })
                 } 
                 
            }else{
                advertiser_id= page.advertiser_id;
                ajaxrequest(advertiser_id, VIDEOCOVER,coverparems).then((res) => {
                    var coverlist=res.data;
                    if(coverlist.code=="SUCCESS"){
                        this.originality[n].paneslist[sub].content.addpanel[i].coverlist = coverlist.data.list;
                        this.coverloding = false;
                    }else{
                        this.coverloding = false;
                        this.$message.error(coverlist.message,3);
                    }
                })
            }
        },

        coverok(n,i){
            this.confirmLoading = true;
            // 公共
            var sub = this.originality[n].customactive-1;
            if(this.originality[n].paneslist[sub].content.addpanel[i].covernum ==0){
                this.confirmLoading = false;
                this.$message.error('请先选择封面图',3);
               return;//仍然阻止不了模态窗关闭
            }
            var cover = this.originality[n].paneslist[sub].content.addpanel[i].coveractive;
            
            this.originality[n].paneslist[sub].content.addpanel[i].covershow = false;
            this.originality[n].paneslist[sub].content.addpanel[i].imageUrl = cover.url;
            this.originality[n].paneslist[sub].content.addpanel[i].image_id = cover.id;
            this.confirmLoading = false;
               
        },
        videocoverok(n,i){
            //确定封面图
            this.confirmLoading = true;
            // 公共
            var sub = this.originality[n].customactive-1;
            if(this.originality[n].paneslist[sub].content.addpanel[i].covernum ==0){
                this.confirmLoading = false;
                this.$message.error('请先选择封面图',3);
               return;//仍然阻止不了模态窗关闭
            }

            var cover = this.originality[n].paneslist[sub].content.addpanel[i].coveractive;
            this.originality[n].paneslist[sub].content.addpanel[i].covershow = false;
            this.originality[n].paneslist[sub].content.addpanel[i].imageUrl = cover.url;
            this.originality[n].paneslist[sub].content.addpanel[i].image_id = cover.id;
            this.confirmLoading = false;
        },

        videocoveroks(n,i){
            //确定封面图
            this.confirmLoading = true;
            // 公共
            var sub = this.originality[n].progractive-1;
            if(this.originality[n].customlist[sub].content.addpanel[i].covernum ==0){
                this.confirmLoading = false;
                this.$message.error('请先选择封面图',3);
               return;//仍然阻止不了模态窗关闭
            }
            var cover = this.originality[n].customlist[sub].content.addpanel[i].coveractive;
            console.log(cover,"333333333333333333");

            this.originality[n].customlist[sub].content.addpanel[i].covershow = false;
            this.originality[n].customlist[sub].content.addpanel[i].imageUrl = cover.url;
            this.originality[n].customlist[sub].content.addpanel[i].image_id = cover.id;
            this.confirmLoading = false;
        },

        coveroks(n,i){
            this.confirmLoading = true;
            // 程序化封面确定
            var sub = this.originality[n].progractive-1;
            if(this.originality[n].customlist[sub].content.addpanel[i].covernum ==0){
                this.confirmLoading = false;
                this.$message.error('请先选择封面图',3);
               return;//仍然阻止不了模态窗关闭
            }

            var cover = this.originality[n].customlist[sub].content.addpanel[i].coveractive;
            this.originality[n].customlist[sub].content.addpanel[i].covershow = false;
            this.originality[n].customlist[sub].content.addpanel[i].imageUrl = cover.url;
            this.originality[n].customlist[sub].content.addpanel[i].image_id = cover.id;
            this.confirmLoading = false;
             
        },
        coverokGroup(n,i,nv){
            this.confirmLoading = true;
            // 组图
            var sub = this.originality[n].customactive-1;
            if(this.originality[n].paneslist[sub].content.addpanel[i].group[nv].nums ==0){
                this.$message.error('请先选择封面图',3);
               return;//仍然阻止不了模态窗关闭
            }
            var cover = this.originality[n].paneslist[sub].content.addpanel[i].group[nv].activeimg;
            this.originality[n].paneslist[sub].content.addpanel[i].group[nv].showis = false;
            this.originality[n].paneslist[sub].content.addpanel[i].group[nv].imgloading = false;
            this.originality[n].paneslist[sub].content.addpanel[i].group[nv].activeimg = cover.url;
            this.originality[n].paneslist[sub].content.addpanel[i].group[nv].img = cover.url;
            this.originality[n].paneslist[sub].content.addpanel[i].group[nv].image_id = cover.id;
            this.confirmLoading = false;
        },

        onhandlecover(n,i){
            //动态词包
            var sub = this.originality[n].customactive -1;
            this.originality[n].paneslist[sub].content.addpanel[i].dynamicmore = false;
        },
        handlecover(n,i){
            //公共
            var sub = this.originality[n].customactive-1;
            this.originality[n].paneslist[sub].content.addpanel[i].covershow = false;
        },

        handlecovers(n,i){
            var sub = this.originality[n].progractive-1;
            this.originality[n].customlist[sub].content.addpanel[i].covershow = false;
        },
        handlecoverGroup(n,i,index){
            // 组图
            var sub = this.originality[n].customactive-1;
            this.originality[n].paneslist[sub].content.addpanel[i].group[index].showis = false;
        },
       
        onaddtitle(n){
            // 程序化添加标题
            if(this.originality[n].input.length > 9){
                this.originality[n].addtitledis = true;
                return;
            }
            var num = this.originality[n].inputnum +1; 
            this.originality[n].input.push({
                value:`titles${num}`,
                nametitle:'',
                dynamicmores:false,
                dynamiclists:[],
                words_ids:[],
            })
            this.originality[n].inputnum = num;
        },
        ondeltitle(n,e){
            // 程序化删除标题
            this.originality[n].input.splice(e, 1)
        },

        newregexp(str){
            //去除重复动态词包
            return new RegExp(str,"g");
        },

        ondynamic(e,n,v,ids){
            // 自定义动态词包
            // var reg = '';
            var sub = this.originality[n].customactive-1;
            this.originality[n].paneslist[sub].content.addpanel[v].dynamicmore = false;
            var name = this.originality[n].paneslist[sub].content.addpanel[v].nametitle;
        
            if(this.originality[n].paneslist[sub].content.addpanel[v].creative_word_ids.length < 2){

                this.originality[n].paneslist[sub].content.addpanel[v].creative_word_ids.push(ids);
                this.originality[n].paneslist[sub].content.addpanel[v].nametitle = name+e;

                // if(name.includes(e)){
				// 	reg = this.newregexp(e,"g");
                //     this.originality[n].paneslist[sub].content.addpanel[v].nametitle = name.replace(reg,"");
                //     this.originality[n].paneslist[sub].content.addpanel[v].creative_word_ids.splice(this.originality[n].paneslist[sub].content.addpanel[v].creative_word_ids.indexOf(ids),1);
                //     // this.originality[n].paneslist[sub].content.addpanel[v].creative_word_ids.push(ids);
				// }else{
                //     this.originality[n].paneslist[sub].content.addpanel[v].nametitle =name+e;
                //     this.originality[n].paneslist[sub].content.addpanel[v].creative_word_ids.push(ids);
                // }

                var data = {};
                var variable = this.originality[n].paneslist[sub].content.addpanel[v].input+n;
                data[variable] = this.originality[n].paneslist[sub].content.addpanel[v].nametitle;

                this.form.setFieldsValue(data)

            }else{
                this.$message.error("最多插入两个词包",3);
            }
        },
        ondynamics(e,v,n,ids){
            // 程序化动态词包
            var reg = '';
            this.originality[n].input[v].dynamicmore = false;
            var name = this.originality[n].input[v].nametitle;
            if(this.originality[n].input[v].words_ids.length <2){
                if(name.includes(e)){
                    reg = this.newregexp(e,"g");
                    this.originality[n].input[v].nametitle = name.replace(reg,"");
                    this.originality[n].input[v].words_ids.splice(this.originality[n].input[v].words_ids.indexOf(ids),1);
				}else{
                    this.originality[n].input[v].nametitle = name+e;
                    this.originality[n].input[v].words_ids.push(ids);
                }
                var data = {};
                var variable = this.originality[n].input[v].value+n+v;
                data[variable] = this.originality[n].input[v].nametitle;
                this.form.setFieldsValue(data)
            }else{
                this.$message.error('最多插入两个词包',3);
            }
        },
        ontitle(n,e,v){
            //标题输入
            var sub = this.originality[n].customactive-1;
            this.originality[n].paneslist[sub].content.addpanel[e].nametitle = v.target.value;
            if(!this.originality[n].paneslist[sub].content.addpanel[e].nametitle.includes(v.target.value)){
                // this.originality[n].paneslist[sub].content.addpanel[v].creative_word_ids.splice(this.originality[n].paneslist[sub].content.addpanel[v].creative_word_ids.indexOf(1),1);
                this.originality[n].paneslist[sub].content.addpanel[e].nametitle = this.originality[n].paneslist[sub].content.addpanel[e].nametitle.replace(v.target.value,""); 
            }
            if(v.target.value ==""){
                this.originality[n].paneslist[sub].content.addpanel[e].creative_word_ids = [];
            }
            var data = {};
            var variable = this.originality[n].paneslist[sub].content.addpanel[e].input+n;
            data[variable] = this.originality[n].paneslist[sub].content.addpanel[e].nametitle;
            this.form.setFieldsValue(data)
        },

        ontitles(n,e,v){
            // 程序化标题
            this.originality[n].input[e].nametitle = v.target.value;
            if(!this.originality[n].input[e].nametitle.includes(v.target.value)){
                // this.originality[n].input[e].words_ids.splice(this.originality[n].input[e].words_ids.indexOf(1),1);
                this.originality[n].input[e].nametitle = this.originality[n].input[e].nametitle.replace(v.target.value,""); 
            }
            if(v.target.value ==""){
                this.originality[n].input[e].words_ids = [];
            }
            var data = {};
            var variable = this.originality[n].input[e].value+n+e;
            data[variable] = this.originality[n].input[e].nametitle;
            this.form.setFieldsValue(data)

        },
        handleCancels(v,n){
            // 程序化取消动态词
            this.originality[n].input[v].dynamicmores = false;
        },
        oncardimg(){
            //素材库
            this.cardbox = true;
        },
        ondynamicmore(n,i){
            var sub = this.originality[n].customactive-1;
            this.originality[n].paneslist[sub].content.addpanel[i].dynamicmore = true;
            this.dynamicloding = true;
            //更多词包
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
            }else{
                advertiser_id = page.advertiser_id;
            }

            ajaxrequest(advertiser_id, DYNAMIC,"").then((res) => {
                var dynamic=res.data;
                if(dynamic.code == 'SUCCESS'){
                    this.originality[n].paneslist[sub].content.addpanel[i].dynamiclist = dynamic.data.creative_word;
                    this.dynamicloding = false;
                }else{
                    this.dynamicloding = false;
                    this.$message.error(dynamic.message,3);
                }
                
            })
        },
        ondynamicmores(n,nv){
            // 动态词包
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
            }else{
                advertiser_id = page.advertiser_id;
            }
            ajaxrequest(advertiser_id, DYNAMIC,"").then((res) => {
                var dynamic=res.data;
                if(dynamic.code == 'SUCCESS'){
                    this.originality[nv].input[n].dynamicmores = true;
                    this.originality[nv].input[n].dynamiclists = dynamic.data.creative_word;
                }else{
                    this.$message.error(dynamic.message,3);
                }
                
            })
        },
        dynamicok(){
            this.dynamicmore = false;
        },
        dynamicCancel(){
            this.dynamicmore = false;
        },
        cardCancel(){
            //取消卡片主图
            this.cardbox = false;
        },
        cardOk(){
            //确定卡片主图
            this.cardbox =false;
        },
        oncardtitle(e){
            //卡片标题
            this.cardtitle = e;
        },
        onpoint(){
            //推广卖点
            if(this.inputlist.length >=10){
                this.btnpoint = true;
                return;
            }else{
                this.btnpoint = false;
            }

            var num = this.pointsnum +1;
            this.inputlist.push({
                valuename:`product_selling_points${num}`,
                value:'',
            });
            this.pointsnum = num;
        },
        onpoints(i,e){
            // 推广卖点获取input内容
            this.inputlist[i].value = e.target.value;
        },
        onsystempoint(){
            // 系统推荐卖点
            this.systemshow = true;
        },
        systemok(){
            this.systemshow = false;
        },
        systemCancel(){
            this.systemshow = false;
        },
        ondelinput(e){
            // console.log(this.inputlist);
            //删除推广卖点
            this.inputlist.splice(e, 1)
        },
        onactiontext(e){
            // 行动号召
            this.actiontext = e.target.value;
        },
        onbrandhone(e){
            // 品牌主页
            this.brandhome = e.target.value;
        },
        oncomment(e){
            //广告评论
            this.comments = e.target.value;
        },
        ontoshow(e){
            //创意展现
            this.toshow = e.target.value;
        },
        onlabel(e){
            //标签(按钮添加)
            if(this.labellist.leng >=20){
                this.$message.error('已超出限制数量');
                return;
            }
            if(this.labellist.indexOf(e)){
                this.labellist.push(e);
            }
        },

        onfontlen(e){
            let leng = this.validateTextLength(e.target.value)
            if(leng >=10){
                // console.log();
                this.$message.error('标签字体过长');
                return;
            }
        },
        validateTextLength (value) {
            // 中文、中文标点、全角字符按1长度，英文、英文符号、数字按0.5长度计算
            let cnReg = /([\u4e00-\u9fa5]|[\u3000-\u303F]|[\uFF00-\uFF60])/g
            let mat = value.match(cnReg)
            let length
            if (mat) {
              length = (mat.length + (value.length - mat.length) * 1)
              return length
            } else {
              return value.length * 1
            }
        },

        dellabel(v){
            //删除标签
            this.labellist.splice(v,1)
        },
        handleAddlabel(e){
            //标签(回车添加)
            // let leng = this.validateTextLength(e.target.value)
            // if(leng >=10){
            //     // console.log();
            //     this.$message.error('标签字数过长');
            //     return;
            // }
            if(this.labellist.leng >=20){
                this.$message.error('已超出限制数量');
                return;
            }

            if(this.labellist.indexOf(e.target.value)){
                this.labellist.push(e.target.value);
            }
        },
        choiceorign(){
            // 选择程序化创意包
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
            }else{
                advertiser_id = page.advertiser_id;
            }
            ajaxrequest(advertiser_id, PROGRAM,"").then((res) => {
                var result=res.data;
                if(result.code =="SUCCESS"){
                    this.choiceorignbox = true;
                    this.choicelist =result.data.list;
                }
            })
        },
        onchoice(){
            // 程序化创意包模式搜索

        },
        cancel(){
            // 取消
            this.$router.push('/promotion/advering/originality')
        },
        async onnext(){
            this.logging = true;
             // 保存
            var storage=window.localStorage;
            var info = storage.getItem("one");
            var page = JSON.parse(info);
            var advertiser_id = '';
            if(page.type ==3){
                advertiser_id= page.list[0].advertiser_id;
            }else{
                advertiser_id = page.advertiser_id;
            }

            this.form.validateFieldsAndScroll((err, values) => {               
                console.log(err);
                var list = [];
                //广告主ID
                values['advertiser_id'] = advertiser_id;
                // 位置
                if(values['a']=='inventory_type'){
                    if(this.mediaboxlist.length ==0){
                        this.$message.error("请选择媒体指定位置", 3);
                        this.logging = false;
                        return;
                    }
                    values['inventory_type'] = this.mediaboxlist;
                }else if(values['a'] =='scene_inventory'){
                    if(this.cenelistbox.length ==0){
                        this.$message.error("请选择场景指定位置", 3);
                        this.logging = false;
                        return;
                    }
                    values['scene_inventory'] = this.cenelistbox[0].value;
                }else{
                    values['smart_inventory'] = 1;
                }
                this.originality.forEach((val)=>{
                    var creatives = [];
                    let title_list = [];
                    var titlearr = [];
                    var crearr =[];
                    // 程序化创意
                    if(val['material'] =="STATIC_ASSEMBLE"){
                        val.customlist.forEach((item)=>{
                            if(item.content.num !== 0){
                                item.content.addpanel.forEach((i)=>{
                                    var derivecid = 0;
                                    if(i.derive_poster_cid == true){
                                        derivecid = 1;
                                    }else{
                                        derivecid = 0;
                                    }
                                    creatives.push({
                                        image_mode:item.value,
                                        title:i.nametitle,
                                        creative_word_ids:i.creative_word_ids,
                                        image_id:i.image_id,
                                        video_id:i.video_id,
                                        derive_poster_cid:derivecid
                                    });
                                })
                            }
                        })
                        val.input.forEach((item)=>{
                            title_list.push({
                                title:item.nametitle,
                                creative_word_ids:item.words_ids
                            });
                        });
                        titlearr = title_list;
                        crearr = creatives;
                    }else{
                    // 自定义创意
                        val.paneslist.forEach((item,index)=>{
                            if(item.content.num !== 0){
                                item.content.addpanel.forEach((i)=>{
                                    var derivecid = 0;
                                    if(i.derive_poster_cid == true){
                                        derivecid = 1;
                                    }else{
                                        derivecid = 0;
                                    }
                                    // console.log("自定义"+i.image_id);
                                    if(index ==3){
                                        creatives.push({
                                            image_mode:item.value,
                                            title:i.nametitle,
                                            creative_word_ids:i.creative_word_ids,
                                            image_ids:[i.group[0].image_id,i.group[1].image_id,i.group[2].image_id],
                                            video_id:i.video_id,
                                            derive_poster_cid:derivecid
                                        });
                                    }else{
                                        creatives.push({
                                            image_mode:item.value,
                                            title:i.nametitle,
                                            creative_word_ids:i.creative_word_ids,
                                            image_id:i.image_id,
                                            video_id:i.video_id,
                                            derive_poster_cid:derivecid
                                        });
                                    }                                    
                                })
                            }
                            crearr = creatives;
                        });
                    }
                    list.push({
                        name:val.originvalue,
                        creative_material_mode:val.material,
                        titlearr,
                        crearr,
                    });
                })


                for (let i = 0; i < list.length; i++) {
                    if(list[i].crearr.length <=0){
                        this.$message.error("请上传创意内容",3);
                        this.logging = false;
                        return false;
                    }
                }

            //    list.forEach((item) =>{
            //        if(item.crearr.length <=0){
            //            this.$message.error("请上传创意内容",3);
            //            return false;
            //        }
            //    })

                values['creatives'] = list;
                    // 同步封面标题
                if(values['derive_poster_cid'] ==true){
                    values['derive_poster_cid'] = 1;
                }else{
                    values['derive_poster_cid'] = 0;
                }
                //品牌主页
                if(values['is_feed_and_fav_see'] ==true){
                    values['is_feed_and_fav_see'] =1;
                }else{
                    values['is_feed_and_fav_see'] = 0;
                }
                //创意标签
                if(this.labellist.length <=0){
                    this.$message.error("请输入创意标签,并按下回车键确认",3);
                    this.logging = false;
                    return;
                }
                values['ad_keywords'] = this.labellist;
                //不开启抖音用户
                if(values['ies_core_user_id'] =='0'){
                    this.$delete(values,'ies_core_user_id');
                }
                if(values['third_industry_id'] !=undefined){
                    values['third_industry_id'] = values['third_industry_id'][2];
                }else{
                    this.$message.error("请选择创意分类");
                    return;
               }
                var storage=window.localStorage;
                var d = JSON.stringify(values);
                storage.setItem("three",d);
                this.logging = false;
                // console.log("通过");
                // console.log(storage.getItem('three'));
                //跳转批量规则
                this.$router.push('/promotion/batchrule');
            })
        },
        imgurl(name) {
            return require("@/assets/img/" + name);
        },
    },
    computed: {
        ...mapGetters('account', ['user']),
        rowmedialist(){
          return {
            onChange: (selectedRowKeys, selectedRows) => {
                this.mediaboxlist = selectedRows
              console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
            },
          };
        },
        rowscenelist(){
            return {
                type:'radio',
                selections:true,
                onChange: (selectedRowKeys, selectedRows) => {
                    this.cenelistbox = selectedRows;
                        // this.selectedRows = selectedRows;
                    console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
                },
            };
        },
        rowsystempoint(){
            return {
                hideDefaultSelections: true,
                onChange: (selectedRowKeys, selectedRows) => {
                    this.rowsystemlist = selectedRows;
                        // this.selectedRows = selectedRows;
                    console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
                },
            };
        },
    }
}